Thread: [Gpredict-svn] SF.net SVN: gpredict:[410] trunk/src (Page 4)
Real time satellite tracking and orbit prediction
Status: Beta
Brought to you by:
csete
|
From: <cs...@us...> - 2009-08-09 00:45:10
|
Revision: 410
http://gpredict.svn.sourceforge.net/gpredict/?rev=410&view=rev
Author: csete
Date: 2009-08-09 00:45:01 +0000 (Sun, 09 Aug 2009)
Log Message:
-----------
Updated to new .sat and .cat files. Buggy (both cat and sat).
Modified Paths:
--------------
trunk/src/tle-update.c
trunk/src/tle-update.h
Modified: trunk/src/tle-update.c
===================================================================
--- trunk/src/tle-update.c 2009-08-09 00:37:09 UTC (rev 409)
+++ trunk/src/tle-update.c 2009-08-09 00:45:01 UTC (rev 410)
@@ -11,17 +11,17 @@
More details can be found at the project home page:
http://gpredict.oz9aec.net/
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program; if not, visit http://www.fsf.org/
*/
@@ -36,7 +36,7 @@
#include "sgpsdp/sgp4sdp4.h"
#include "sat-log.h"
#include "sat-cfg.h"
-#include "tle-lookup.h"
+#include "compat.h"
#include "tle-update.h"
@@ -60,12 +60,12 @@
static gint read_fresh_tle (const gchar *dir, const gchar *fnam, GHashTable *data);
static void update_tle_in_file (const gchar *ldname,
- const gchar *fname,
- GHashTable *data,
- guint *sat_upd,
- guint *sat_ski,
- guint *sat_nod,
- guint *sat_tot);
+ const gchar *fname,
+ GHashTable *data,
+ guint *sat_upd,
+ guint *sat_ski,
+ guint *sat_nod,
+ guint *sat_tot);
static guint add_new_sats (GHashTable *data);
@@ -81,6 +81,7 @@
g_free (tle->satname);
g_free (tle->line1);
g_free (tle->line2);
+ g_free (tle->srcfile);
g_free (tle);
}
@@ -103,10 +104,9 @@
* Functional description: TBD
*
*/
-void
-tle_update_from_files (const gchar *dir, const gchar *filter,
- gboolean silent, GtkWidget *progress,
- GtkWidget *label1, GtkWidget *label2)
+void tle_update_from_files (const gchar *dir, const gchar *filter,
+ gboolean silent, GtkWidget *progress,
+ GtkWidget *label1, GtkWidget *label2)
{
GHashTable *data; /* hash table with fresh TLE data */
GDir *cache_dir; /* directory to scan fresh TLE */
@@ -114,6 +114,7 @@
GError *err = NULL;
gchar *text;
gchar *ldname;
+ gchar *userconfdir;
const gchar *fnam;
guint num = 0;
guint updated,updated_tmp;
@@ -137,14 +138,14 @@
/* send an error message */
sat_log_log (SAT_LOG_LEVEL_ERROR,
- _("%s: Error opening directory %s (%s)"),
- __FUNCTION__, dir, err->message);
+ _("%s: Error opening directory %s (%s)"),
+ __FUNCTION__, dir, err->message);
/* insert error message into the status string, too */
if (!silent && (label1 != NULL)) {
text = g_strdup_printf (_("<b>ERROR</b> opening directory %s\n%s"),
dir, err->message);
-
+
gtk_label_set_markup (GTK_LABEL (label1), text);
g_free (text);
@@ -163,14 +164,14 @@
text = g_strdup_printf (_("Reading data from %s"), fnam);
gtk_label_set_text (GTK_LABEL (label1), text);
g_free (text);
-
+
/* Force the drawing queue to be processed otherwise there will
not be any visual feedback, ie. frozen GUI
- see Gtk+ FAQ http://www.gtk.org/faq/#AEN602
*/
while (g_main_context_iteration (NULL, FALSE));
-
+
/* give user a chance to follow progress */
g_usleep (G_USEC_PER_SEC / 10);
}
@@ -180,29 +181,24 @@
if (num < 1) {
sat_log_log (SAT_LOG_LEVEL_ERROR,
- _("%s: No valid TLE data found in %s"),
- __FUNCTION__, fnam);
+ _("%s: No valid TLE data found in %s"),
+ __FUNCTION__, fnam);
}
else {
sat_log_log (SAT_LOG_LEVEL_MSG,
- _("%s: Read %d sats from %s into memory"),
- __FUNCTION__, num, fnam);
+ _("%s: Read %d sats from %s into memory"),
+ __FUNCTION__, num, fnam);
}
}
/* close directory since we don't need it anymore */
g_dir_close (cache_dir);
- /* store number of available sats */
- num = tle_lookup_count ();
-
-
/* now it is time to read gpredict-tle into memory, too */
- ldname = g_strconcat (g_get_home_dir (), G_DIR_SEPARATOR_S,
- ".gpredict2", G_DIR_SEPARATOR_S,
- "tle", NULL);
+ userconfdir = get_user_conf_dir ();
+ ldname = g_strconcat (userconfdir, G_DIR_SEPARATOR_S, "satdata", NULL);
+ g_free (userconfdir);
-
/* open directory and read files one by one */
loc_dir = g_dir_open (ldname, 0, &err);
@@ -210,14 +206,14 @@
/* send an error message */
sat_log_log (SAT_LOG_LEVEL_ERROR,
- _("%s: Error opening directory %s (%s)"),
- __FUNCTION__, dir, err->message);
+ _("%s: Error opening directory %s (%s)"),
+ __FUNCTION__, dir, err->message);
/* insert error message into the status string, too */
if (!silent && (label1 != NULL)) {
text = g_strdup_printf (_("<b>ERROR</b> opening directory %s\n%s"),
dir, err->message);
-
+
gtk_label_set_markup (GTK_LABEL (label1), text);
g_free (text);
}
@@ -236,12 +232,20 @@
if (progress != NULL)
start = gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (progress));
+ /* This is insane but I don't know how else to count the number of sats */
+ num = 0;
+ while ((fnam = g_dir_read_name (loc_dir)) != NULL) {
+ /* only consider .sat files */
+ if (g_strrstr (fnam, ".sat")) {
+ num++;
+ }
+ }
+
/* update TLE files one by one */
while ((fnam = g_dir_read_name (loc_dir)) != NULL) {
+ /* only consider .sat files */
+ if (g_strrstr (fnam, ".sat")) {
- /* skip 'cache' directory */
- if (g_ascii_strcasecmp (fnam, "cache")) {
-
/* clear stat bufs */
updated_tmp = 0;
skipped_tmp = 0;
@@ -271,8 +275,8 @@
if (label2 != NULL) {
text = g_strdup_printf (_("Satellites updated:\t %d\n"\
- "Satellites skipped:\t %d\n"\
- "Missing Satellites:\t %d\n"),
+ "Satellites skipped:\t %d\n"\
+ "Missing Satellites:\t %d\n"),
updated, skipped, nodata);
gtk_label_set_text (GTK_LABEL (label2), text);
g_free (text);
@@ -289,7 +293,7 @@
fraction = 0.98;
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress),
- fraction);
+ fraction);
}
@@ -303,7 +307,7 @@
g_usleep (G_USEC_PER_SEC / 10);
}
}
-
+
}
/* close directory handle */
@@ -319,7 +323,7 @@
"Satellites skipped:\t %d\n"\
"Missing Satellites:\t %d\n"\
"New Satellites:\t\t %d"),
- updated, skipped, nodata, newsats);
+ updated, skipped, nodata, newsats);
gtk_label_set_text (GTK_LABEL (label2), text);
g_free (text);
@@ -327,7 +331,7 @@
sat_log_log (SAT_LOG_LEVEL_MSG,
_("%s: Added %d new satellites to local database"),
- __FUNCTION__, newsats);
+ __FUNCTION__, newsats);
}
/* store time of update if we have updated something */
@@ -343,8 +347,8 @@
g_free (ldname);
sat_log_log (SAT_LOG_LEVEL_MSG,
- _("%s: TLE elements updated."),
- __FUNCTION__);
+ _("%s: TLE elements updated."),
+ __FUNCTION__);
}
/* destroy hash tables */
@@ -356,34 +360,113 @@
/** \brief Check if satellite is new, if so, add it to local database */
static void check_and_add_sat (gpointer key, gpointer value, gpointer user_data)
{
- gchar *ofn;
- FILE *fp;
- new_tle_t *ntle = (new_tle_t *) value;
- guint *num = user_data;
+ new_tle_t *ntle = (new_tle_t *) value;
+ guint *num = user_data;
+ GKeyFile *satdata;
+ GIOChannel *satfile;
+ gchar *cfgstr, *cfgfile;
+ gsize length, written;
+ guint catnum = GPOINTER_TO_UINT (key);
+ GError *err = NULL;
+
/* check if sat is new */
if (ntle->isnew) {
-
- /* Open $HOME/.gpredict2/tle/new.tle */
- ofn = g_strconcat (g_get_home_dir(), G_DIR_SEPARATOR_S,
- ".gpredict2", G_DIR_SEPARATOR_S,
- "tle", G_DIR_SEPARATOR_S,
- "new.tle", NULL);
- fp = g_fopen (ofn, "a");
- g_free (ofn);
-
- /* store tle data to file */
- if (fp) {
- fputs (ntle->satname, fp);
- fputs (ntle->line1, fp);
- fputs (ntle->line2, fp);
-
- /* close file */
- fclose (fp);
-
- /* update data */
- *num += 1;
+
+ /* create config data */
+ satdata = g_key_file_new ();
+
+ /* store data */
+ g_key_file_set_string (satdata, "Satellite", "VERSION", "1.1");
+ g_key_file_set_string (satdata, "Satellite", "NAME", ntle->satname);
+ g_key_file_set_string (satdata, "Satellite", "NICKNAME", ntle->satname);
+ g_key_file_set_string (satdata, "Satellite", "TLE1", ntle->line1);
+ g_key_file_set_string (satdata, "Satellite", "TLE2", ntle->line2);
+
+ /* convert data to text */
+ cfgstr = g_key_file_to_data (satdata, &length, NULL);
+
+ /* create an I/O channel and store data */
+ cfgfile = sat_file_name_from_catnum (catnum);
+ satfile = g_io_channel_new_file (cfgfile, "w", &err);
+
+ if (err != NULL) {
+ sat_log_log (SAT_LOG_LEVEL_ERROR,
+ _("%s: Could not create satellite file (%s)."),
+ __FUNCTION__, err->message);
+ g_clear_error (&err);
}
+ else {
+ g_io_channel_write_chars (satfile, cfgstr, length, &written, &err);
+ g_io_channel_shutdown (satfile, TRUE, NULL);
+ g_io_channel_unref (satfile);
+
+ if (err != NULL) {
+ sat_log_log (SAT_LOG_LEVEL_ERROR,
+ _("%s: Error writing satellite data for %d (%s)."),
+ __FUNCTION__, catnum, err->message);
+ g_clear_error (&err);
+ }
+ else if (length != written) {
+ sat_log_log (SAT_LOG_LEVEL_WARN,
+ _("%s: Wrote only %d out of %d chars for satellite data %d."),
+ __FUNCTION__, written, length, catnum);
+ }
+ else {
+ sat_log_log (SAT_LOG_LEVEL_MSG,
+ _("%s: Satellite data written for %d."),
+ __FUNCTION__, catnum);
+ *num += 1;
+ }
+ }
+
+ /* clean up memory */
+ g_free (cfgstr);
+ g_free (cfgfile);
+ g_key_file_free (satdata);
+
+
+ /**** FIXME: NEED TO CREATE COPY of cache */
+ /* finally, new satellite must be added to proper category */
+ gchar *catfile;
+ gchar **buff;
+
+ buff = g_strsplit (ntle->srcfile, ".", 0);
+ cfgfile = g_strconcat (buff[0], ".cat", NULL);
+ catfile = sat_file_name (cfgfile);
+
+ /* g_io_channel */
+ satfile = g_io_channel_new_file (catfile, "a", &err);
+
+ if (err != NULL) {
+ sat_log_log (SAT_LOG_LEVEL_ERROR,
+ _("%s: Could not open category file file %s (%s)."),
+ __FUNCTION__, cfgfile, err->message);
+ g_clear_error (&err);
+ }
+ else {
+ cfgstr = g_strdup_printf ("%d\n", catnum);
+ g_io_channel_write_chars (satfile, cfgstr, -1, NULL, &err);
+ g_io_channel_shutdown (satfile, TRUE, NULL);
+ g_io_channel_unref (satfile);
+ g_free (cfgstr);
+
+ if (err != NULL) {
+ sat_log_log (SAT_LOG_LEVEL_ERROR,
+ _("%s: Error adding %d to %s (%s)."),
+ __FUNCTION__, catnum, cfgfile, err->message);
+ g_clear_error (&err);
+ }
+ else {
+ sat_log_log (SAT_LOG_LEVEL_MSG,
+ _("%s: Added satellite %d to %s."),
+ __FUNCTION__, catnum, cfgfile);
+ }
+ }
+
+ g_free (catfile);
+ g_free (cfgfile);
+ g_strfreev (buff);
}
}
@@ -406,12 +489,11 @@
* \param label1 GtkLabel for activity string.
* \param label2 GtkLabel for statistics string.
*/
-void
-tle_update_from_network (gboolean silent,
- GtkWidget *progress,
- GtkWidget *label1,
- GtkWidget *label2)
- {
+void tle_update_from_network (gboolean silent,
+ GtkWidget *progress,
+ GtkWidget *label1,
+ GtkWidget *label2)
+{
gchar *server;
gchar *proxy = NULL;
gchar *files_tmp;
@@ -419,6 +501,7 @@
guint numfiles,i;
gchar *curfile;
gchar *locfile;
+ gchar *userconfdir;
CURL *curl;
CURLcode res;
gboolean error = FALSE;
@@ -448,8 +531,8 @@
if (numfiles < 1) {
sat_log_log (SAT_LOG_LEVEL_ERROR,
- _("%s: No files to fetch from network."),
- __FUNCTION__);
+ _("%s: No files to fetch from network."),
+ __FUNCTION__);
/* set activity string, so user knows why nothing happens */
if (!silent && (label1 != NULL)) {
@@ -492,12 +575,12 @@
while (g_main_context_iteration (NULL, FALSE));
}
- /* create local file */
- locfile = g_strconcat (g_get_home_dir (), G_DIR_SEPARATOR_S,
- ".gpredict2", G_DIR_SEPARATOR_S,
- "tle", G_DIR_SEPARATOR_S,
- "cache", G_DIR_SEPARATOR_S,
- files[i], NULL);
+ /* creae local cache file */
+ userconfdir = get_user_conf_dir ();
+ locfile = g_strconcat (userconfdir, G_DIR_SEPARATOR_S,
+ "satdata", G_DIR_SEPARATOR_S,
+ "cache", G_DIR_SEPARATOR_S,
+ files[i], NULL);
outfile = g_fopen (locfile, "wb");
curl_easy_setopt (curl, CURLOPT_WRITEDATA, outfile);
curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, my_write_func);
@@ -507,14 +590,14 @@
if (res != CURLE_OK) {
sat_log_log (SAT_LOG_LEVEL_ERROR,
- _("%s: Error fetching %s (%s)"),
- __FUNCTION__, curfile, curl_easy_strerror (res));
+ _("%s: Error fetching %s (%s)"),
+ __FUNCTION__, curfile, curl_easy_strerror (res));
error = TRUE;
}
else {
sat_log_log (SAT_LOG_LEVEL_MSG,
- _("%s: Successfully fetched %s"),
- __FUNCTION__, curfile);
+ _("%s: Successfully fetched %s"),
+ __FUNCTION__, curfile);
success++;
}
@@ -533,6 +616,7 @@
}
+ g_free (userconfdir);
g_free (curfile);
g_free (locfile);
fclose (outfile);
@@ -543,14 +627,11 @@
/* continue update if we have fetched at least one file */
if (success > 0) {
/* call update_from_files */
- cache = g_strconcat (g_get_home_dir (), G_DIR_SEPARATOR_S,
- ".gpredict2", G_DIR_SEPARATOR_S,
- "tle", G_DIR_SEPARATOR_S,
- "cache", NULL);
+ cache = sat_file_name ("cache");
tle_update_from_files (cache, NULL, silent, progress, label1, label2);
g_free (cache);
}
-
+
}
/* clear cache and memory */
@@ -561,17 +642,14 @@
g_free (proxy);
/* open cache */
- cache = g_strconcat (g_get_home_dir (), G_DIR_SEPARATOR_S,
- ".gpredict2", G_DIR_SEPARATOR_S,
- "tle", G_DIR_SEPARATOR_S,
- "cache", NULL);
+ cache = sat_file_name ("cache");
dir = g_dir_open (cache, 0, &err);
if (err != NULL) {
/* send an error message */
sat_log_log (SAT_LOG_LEVEL_ERROR,
- _("%s: Error opening %s (%s)"),
- __FUNCTION__, dir, err->message);
+ _("%s: Error opening %s (%s)"),
+ __FUNCTION__, dir, err->message);
g_clear_error (&err);
}
else {
@@ -579,7 +657,7 @@
while ((fname = g_dir_read_name (dir)) != NULL) {
locfile = g_strconcat (cache, G_DIR_SEPARATOR_S,
- fname, NULL);
+ fname, NULL);
g_remove (locfile);
g_free (locfile);
@@ -606,8 +684,7 @@
* This function writes the received data to the file pointed to by stream.
* It is used as write callback by to curl exec function.
*/
-static size_t
-my_write_func (void *ptr, size_t size, size_t nmemb, FILE *stream)
+static size_t my_write_func (void *ptr, size_t size, size_t nmemb, FILE *stream)
{
/*** FIXME: TBC whether this works in wintendo */
return fwrite (ptr, size, nmemb, stream);
@@ -621,8 +698,7 @@
* \param fresh_data Hash table where the data should be stored.
* \return The number of satellites successfully read.
*/
-static gint
-read_fresh_tle (const gchar *dir, const gchar *fnam, GHashTable *data)
+static gint read_fresh_tle (const gchar *dir, const gchar *fnam, GHashTable *data)
{
new_tle_t *ntle;
tle_t tle;
@@ -659,21 +735,21 @@
if (Get_Next_Tle_Set (tle_str, &tle) != 1) {
/* TLE data not good */
sat_log_log (SAT_LOG_LEVEL_ERROR,
- _("%s:%s: Invalid data for %d"),
- __FILE__, __FUNCTION__, catnr);
+ _("%s:%s: Invalid data for %d"),
+ __FILE__, __FUNCTION__, catnr);
}
else {
/* DATA OK, phew... */
- /* sat_log_log (SAT_LOG_LEVEL_DEBUG, */
- /* _("%s: Good data for %d"), */
- /* __FUNCTION__, */
- /* catnr); */
+ /* sat_log_log (SAT_LOG_LEVEL_DEBUG, */
+ /* _("%s: Good data for %d"), */
+ /* __FUNCTION__, */
+ /* catnr); */
/* add data to hash table */
key = g_try_new0 (guint, 1);
*key = catnr;
-
+ /* check if satellite already in hash table */
if (g_hash_table_lookup (data, key) == NULL) {
/* create new_tle structure */
@@ -682,6 +758,7 @@
ntle->satname = g_strdup (tle_str[0]);
ntle->line1 = g_strdup (tle_str[1]);
ntle->line2 = g_strdup (tle_str[2]);
+ ntle->srcfile = g_strdup (fnam);
ntle->isnew = TRUE; /* flag will be reset when using data */
@@ -702,8 +779,8 @@
else {
sat_log_log (SAT_LOG_LEVEL_ERROR,
- _("%s:%s: Failed to open %s"),
- __FILE__, __FUNCTION__, path);
+ _("%s:%s: Failed to open %s"),
+ __FILE__, __FUNCTION__, path);
}
g_free (path);
@@ -730,180 +807,139 @@
* When all sats have been copied ldname/fnam is deleted and temp_file
* is renamed to ldname/fnam.
*/
-static void
-update_tle_in_file (const gchar *ldname,
- const gchar *fname,
- GHashTable *data,
- guint *sat_upd,
- guint *sat_ski,
- guint *sat_nod,
- guint *sat_tot)
+static void update_tle_in_file (const gchar *ldname,
+ const gchar *fname,
+ GHashTable *data,
+ guint *sat_upd,
+ guint *sat_ski,
+ guint *sat_nod,
+ guint *sat_tot)
{
gchar *path;
- gchar *tmp_path;
guint updated = 0; /* number of updated sats */
guint nodata = 0; /* no sats for which no fresh data available */
guint skipped = 0; /* no. sats where fresh data is older */
guint total = 0; /* total no. of sats in gpredict tle file */
- gchar tle_str[3][80];
- gchar catstr[6];
- gchar *b;
- FILE *fp;
- FILE *tmp;
- guint catnr,i;
+ gchar **catstr;
+ guint catnr;
guint *key = NULL;
tle_t tle;
new_tle_t *ntle;
- gint retcode = 0;
+ GError *error = NULL;
+ GKeyFile *satdata;
+ gchar *tlestr1, *tlestr2, *rawtle;
+ gchar *cfgstr;
+ GIOChannel *cfgfile;
+ gsize length, written;
/* open input file (file containing old tle) */
path = g_strconcat (ldname, G_DIR_SEPARATOR_S, fname, NULL);
- fp = g_fopen (path, "r");
+ satdata = g_key_file_new ();
+ if (!g_key_file_load_from_file (satdata, path, G_KEY_FILE_KEEP_COMMENTS, &error)) {
+ sat_log_log (SAT_LOG_LEVEL_ERROR,
+ _("%s: Error loading %s (%s)"),
+ __FUNCTION__, path, error->message);
+ g_clear_error (&error);
- if (fp != NULL) {
+ skipped++;
- /* open output temp file */
- tmp_path = g_strconcat (ldname, G_DIR_SEPARATOR_S, "TLEUPDATE.tmp", NULL);
- tmp = g_fopen (tmp_path, "w");
+ }
- if (tmp != NULL) {
+ else {
- /* read 3 lines at a time */
- while (fgets (tle_str[0], 80, fp)) {
- /* read second and third lines */
- b = fgets (tle_str[1], 80, fp);
- b = fgets (tle_str[2], 80, fp);
+ /* get catalog number for this satellite */
+ catstr = g_strsplit (fname, ".sat", 0);
+ catnr = (guint) g_ascii_strtod (catstr[0], NULL);
- /* stats */
- total++;
+ /* see if we have new data for this satellite */
+ key = g_try_new0 (guint, 1);
+ *key = catnr;
+ ntle = (new_tle_t *) g_hash_table_lookup (data, key);
+ g_free (key);
- /* copy catnum and convert to integer */
- for (i = 2; i < 7; i++) {
- catstr[i-2] = tle_str[1][i];
- }
- catstr[5] = '\0';
- catnr = (guint) g_ascii_strtod (catstr, NULL);
+ if (ntle == NULL) {
+ /* no new data found for this sat => obsolete */
+ nodata++;
+ /* check if obsolete sats should be deleted */
+ /**** FIXME: This is dangereous, so we omit it */
+ sat_log_log (SAT_LOG_LEVEL_MSG,
+ _("%s: No new TLE data found for %d. Satellite might be obsolete."),
+ __FUNCTION__, catnr);
+ }
+ else {
+ /* get TLE data */
+ tlestr1 = g_key_file_get_string (satdata, "Satellite", "TLE1", NULL);
+ tlestr2 = g_key_file_get_string (satdata, "Satellite", "TLE2", NULL);
+ rawtle = g_strconcat (tlestr1, tlestr2, NULL);
- if (Get_Next_Tle_Set (tle_str, &tle) != 1) {
- /* TLE data not good */
- sat_log_log (SAT_LOG_LEVEL_ERROR,
- _("%s:%s: Original data for %d seems to be bad"),
- __FILE__, __FUNCTION__, catnr);
- }
-
- /* get data from hash table */
- key = g_try_new0 (guint, 1);
- *key = catnr;
- ntle = (new_tle_t *) g_hash_table_lookup (data, key);
- g_free (key);
+ if (!Good_Elements (rawtle)) {
+ sat_log_log (SAT_LOG_LEVEL_WARN,
+ _("%s: Current TLE data for %d appears to be bad"),
+ __FUNCTION__, catnr);
+ }
+ Convert_Satellite_Data (rawtle, &tle);
- if (ntle == NULL) {
+ g_free (tlestr1);
+ g_free (tlestr2);
+ g_free (rawtle);
- /* no new data found for this sat => obsolete */
- nodata++;
-
- /* check if obsolete sats should be deleted */
- /**** FIXME: This is dangereous, so we omit it */
+ if (tle.epoch < ntle->epoch) {
+ /* new data is newer than what we already have */
+ /* store new data */
+ g_key_file_set_string (satdata, "Satellite", "TLE1", ntle->line1);
+ g_key_file_set_string (satdata, "Satellite", "TLE2", ntle->line2);
+ /* convert configuration data struct to charachter string */
+ cfgstr = g_key_file_to_data (satdata, &length, NULL); /* this function never reports error */
+
+ /* create and open a file for writing */
+ cfgfile = g_io_channel_new_file (path, "w", &error);
+
+ if (error != NULL) {
+ sat_log_log (SAT_LOG_LEVEL_ERROR,
+ _("%s: Could not create satellite data file (%s)."),
+ __FUNCTION__, error->message);
+ g_clear_error (&error);
+ skipped++;
}
else {
+ g_io_channel_write_chars (cfgfile, cfgstr, length, &written, &error);
- /* new data is available for this sat */
- if (tle.epoch < ntle->epoch) {
- /* fresh data is newer than original
- => update
- */
- updated++;
+ g_io_channel_shutdown (cfgfile, TRUE, NULL);
+ g_io_channel_unref (cfgfile);
- /* write new data to file */
- fputs (ntle->satname, tmp);
- fputs (ntle->line1, tmp);
- fputs (ntle->line2, tmp);
-
+ if (error != NULL) {
+ sat_log_log (SAT_LOG_LEVEL_ERROR,
+ _("%s: Error writing satellite data (%s)."),
+ __FUNCTION__, error->message);
+ g_clear_error (&error);
+ skip...
[truncated message content] |
|
From: <cs...@us...> - 2009-08-09 23:20:27
|
Revision: 412
http://gpredict.svn.sourceforge.net/gpredict/?rev=412&view=rev
Author: csete
Date: 2009-08-09 23:20:21 +0000 (Sun, 09 Aug 2009)
Log Message:
-----------
Update now works, but new sats are still not added properly.
Modified Paths:
--------------
trunk/src/tle-update.c
trunk/src/tle-update.h
Modified: trunk/src/tle-update.c
===================================================================
--- trunk/src/tle-update.c 2009-08-09 00:46:12 UTC (rev 411)
+++ trunk/src/tle-update.c 2009-08-09 23:20:21 UTC (rev 412)
@@ -49,13 +49,6 @@
/* private function prototypes */
-#if 0
-static void copy_tle (tle_t *source, tle_t *target);
-static gint compare_epoch (tle_t *tle1, tle_t *tle2);
-static tle_t *gchar_to_tle (tle_type_t type, const gchar *lines);
-static gchar *tle_to_gchar (tle_type_t type, tle_t *tle);
-#endif
-
static size_t my_write_func (void *ptr, size_t size, size_t nmemb, FILE *stream);
static gint read_fresh_tle (const gchar *dir, const gchar *fnam, GHashTable *data);
@@ -173,7 +166,7 @@
while (g_main_context_iteration (NULL, FALSE));
/* give user a chance to follow progress */
- g_usleep (G_USEC_PER_SEC / 10);
+ g_usleep (G_USEC_PER_SEC / 100);
}
/* now, do read the fresh data */
@@ -194,7 +187,7 @@
/* close directory since we don't need it anymore */
g_dir_close (cache_dir);
- /* now it is time to read gpredict-tle into memory, too */
+ /* now we load each .sat file and update if we have new data */
userconfdir = get_user_conf_dir ();
ldname = g_strconcat (userconfdir, G_DIR_SEPARATOR_S, "satdata", NULL);
g_free (userconfdir);
@@ -241,6 +234,8 @@
}
}
+ g_dir_rewind (loc_dir);
+
/* update TLE files one by one */
while ((fnam = g_dir_read_name (loc_dir)) != NULL) {
/* only consider .sat files */
@@ -264,7 +259,7 @@
updated += updated_tmp;
skipped += skipped_tmp;
nodata += nodata_tmp;
- total += total_tmp;
+ total = updated+skipped+nodata;
if (!silent) {
@@ -304,10 +299,9 @@
while (g_main_context_iteration (NULL, FALSE));
/* give user a chance to follow progress */
- g_usleep (G_USEC_PER_SEC / 10);
+ g_usleep (G_USEC_PER_SEC / 1000);
}
}
-
}
/* close directory handle */
@@ -357,6 +351,7 @@
}
+
/** \brief Check if satellite is new, if so, add it to local database */
static void check_and_add_sat (gpointer key, gpointer value, gpointer user_data)
{
@@ -366,13 +361,16 @@
GIOChannel *satfile;
gchar *cfgstr, *cfgfile;
gsize length, written;
- guint catnum = GPOINTER_TO_UINT (key);
GError *err = NULL;
+ g_print ("==> Add new sat %d?\n", ntle->catnum);
+
/* check if sat is new */
if (ntle->isnew) {
+ g_print ("-----> YES!\n");
+
/* create config data */
satdata = g_key_file_new ();
@@ -387,7 +385,7 @@
cfgstr = g_key_file_to_data (satdata, &length, NULL);
/* create an I/O channel and store data */
- cfgfile = sat_file_name_from_catnum (catnum);
+ cfgfile = sat_file_name_from_catnum (ntle->catnum);
satfile = g_io_channel_new_file (cfgfile, "w", &err);
if (err != NULL) {
@@ -404,18 +402,18 @@
if (err != NULL) {
sat_log_log (SAT_LOG_LEVEL_ERROR,
_("%s: Error writing satellite data for %d (%s)."),
- __FUNCTION__, catnum, err->message);
+ __FUNCTION__, ntle->catnum, err->message);
g_clear_error (&err);
}
else if (length != written) {
sat_log_log (SAT_LOG_LEVEL_WARN,
_("%s: Wrote only %d out of %d chars for satellite data %d."),
- __FUNCTION__, written, length, catnum);
+ __FUNCTION__, written, length, ntle->catnum);
}
else {
sat_log_log (SAT_LOG_LEVEL_MSG,
_("%s: Satellite data written for %d."),
- __FUNCTION__, catnum);
+ __FUNCTION__, ntle->catnum);
*num += 1;
}
}
@@ -445,7 +443,7 @@
g_clear_error (&err);
}
else {
- cfgstr = g_strdup_printf ("%d\n", catnum);
+ cfgstr = g_strdup_printf ("%d\n", ntle->catnum);
g_io_channel_write_chars (satfile, cfgstr, -1, NULL, &err);
g_io_channel_shutdown (satfile, TRUE, NULL);
g_io_channel_unref (satfile);
@@ -454,13 +452,13 @@
if (err != NULL) {
sat_log_log (SAT_LOG_LEVEL_ERROR,
_("%s: Error adding %d to %s (%s)."),
- __FUNCTION__, catnum, cfgfile, err->message);
+ __FUNCTION__, ntle->catnum, cfgfile, err->message);
g_clear_error (&err);
}
else {
sat_log_log (SAT_LOG_LEVEL_MSG,
_("%s: Added satellite %d to %s."),
- __FUNCTION__, catnum, cfgfile);
+ __FUNCTION__, ntle->catnum, cfgfile);
}
}
@@ -468,7 +466,7 @@
g_free (cfgfile);
g_strfreev (buff);
}
-
+
}
@@ -476,13 +474,14 @@
static guint add_new_sats (GHashTable *data)
{
guint num = 0;
-
+
g_hash_table_foreach (data, check_and_add_sat, &num);
-
+
return num;
}
+
/** \brief Update TLE files from network.
* \param silent TRUE if function should execute without graphical status indicator.
* \param progress Pointer to a GtkProgressBar progress indicator (can be NULL)
@@ -724,6 +723,9 @@
b = fgets (tle_str[1], 80, fp);
b = fgets (tle_str[2], 80, fp);
+ tle_str[1][69] = '\0';
+ tle_str[2][69] = '\0';
+
/* copy catnum and convert to integer */
for (i = 2; i < 7; i++) {
catstr[i-2] = tle_str[1][i];
@@ -754,6 +756,7 @@
/* create new_tle structure */
ntle = g_try_new (new_tle_t, 1);
+ ntle->catnum = catnr;
ntle->epoch = tle.epoch;
ntle->satname = g_strdup (tle_str[0]);
ntle->line1 = g_strdup (tle_str[1]);
@@ -864,11 +867,14 @@
/* check if obsolete sats should be deleted */
/**** FIXME: This is dangereous, so we omit it */
- sat_log_log (SAT_LOG_LEVEL_MSG,
+ sat_log_log (SAT_LOG_LEVEL_ERROR,
_("%s: No new TLE data found for %d. Satellite might be obsolete."),
__FUNCTION__, catnr);
}
else {
+ /* This satellite is not new */
+ ntle->isnew = FALSE;
+
/* get TLE data */
tlestr1 = g_key_file_get_string (satdata, "Satellite", "TLE1", NULL);
tlestr2 = g_key_file_get_string (satdata, "Satellite", "TLE2", NULL);
@@ -930,12 +936,11 @@
updated++;
}
}
-
g_free (cfgstr);
-
- /* mark this satellite as not new */
- ntle->isnew = FALSE;
}
+ else {
+ skipped++;
+ }
}
g_strfreev (catstr);
}
@@ -952,84 +957,8 @@
-#if 0
-/** \brief Copy a TLE structure.
- * \param source The TLE structure to copy from.
- * \param target The TLE structure to copy to.
- *
- */
-static void
- copy_tle (tle_t *source, tle_t *target)
-{
- target->epoch = source->epoch;
- target->epoch_year = source->epoch_year;
- target->epoch_day = source->epoch_day;
- target->epoch_fod = source->epoch_fod;
- target->xndt2o = source->xndt2o;
- target->xndd6o = source->xndd6o;
- target->bstar = source->bstar;
- target->xincl = source->xincl;
- target->xnodeo = source->xnodeo;
- target->eo = source->eo;
- target->omegao = source->omegao;
- target->xmo = source->xmo;
- target->xno = source->xno;
- /*target->catnr = source->catnr;*/
- target->elset = source->elset;
- target->revnum = source->revnum;
- target->status = source->status;
- /*
- target->xincl1 = source->xincl1;
- target->xnodeo1 = source->xnodeo1;
- target->omegao1 = source->omegao1;
- */
-}
-
-
-/** \brief Compare EPOCH of two element sets
- * \param tle1 The first element set.
- * \param tle2 The second element set.
- * \return 0 if the epochs are equal, -1 if tle1->epoch < tle2->epoch, and
- * +1 if tle1->epoch > tle2->epoch.
- */
-static gint
- compare_epoch (tle_t *tle1, tle_t *tle2)
-{
- gint retval = 0;
-
-
- if (tle1->epoch > tle2->epoch)
- retval = 1;
- else if (tle1->epoch < tle2->epoch)
- retval = -1;
- else
- retval = 0;
-
-
- return retval;
-}
-
-
-static tle_t *
- gchar_to_tle (tle_type_t type, const gchar *lines)
-{
- return NULL;
-}
-
-
-static gchar *
- tle_to_gchar (tle_type_t type, tle_t *tle)
-{
- return NULL;
-}
-#endif
-
-
-
-
-
const gchar *freq_to_str[TLE_AUTO_UPDATE_NUM] = {
N_("Never"),
N_("Monthly"),
Modified: trunk/src/tle-update.h
===================================================================
--- trunk/src/tle-update.h 2009-08-09 00:46:12 UTC (rev 411)
+++ trunk/src/tle-update.h 2009-08-09 23:20:21 UTC (rev 412)
@@ -58,6 +58,7 @@
/** \brief Data structure to hold a TLE set. */
typedef struct {
+ guint catnum; /*!< Catalog number. */
gdouble epoch; /*!< Epoch. */
gchar *satname; /*!< Satellite name. */
gchar *line1; /*!< Line 1. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cs...@us...> - 2009-08-23 14:22:47
|
Revision: 419
http://gpredict.svn.sourceforge.net/gpredict/?rev=419&view=rev
Author: csete
Date: 2009-08-23 14:22:39 +0000 (Sun, 23 Aug 2009)
Log Message:
-----------
Added files for new satellite selector.
Modified Paths:
--------------
trunk/src/Makefile.am
Added Paths:
-----------
trunk/src/gtk-sat-selector.c
trunk/src/gtk-sat-selector.h
Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am 2009-08-15 12:50:23 UTC (rev 418)
+++ trunk/src/Makefile.am 2009-08-23 14:22:39 UTC (rev 419)
@@ -52,6 +52,7 @@
gtk-sat-module.c gtk-sat-module.h \
gtk-sat-module-popup.c gtk-sat-module-popup.h \
gtk-sat-module-tmg.c gtk-sat-module-tmg.h \
+ gtk-sat-selector.c gtk-sat-slector.h \
gtk-sat-tree.c gtk-sat-tree.h \
gtk-single-sat.c gtk-single-sat.h \
gtk-sky-glance.c gtk-sky-glance.h \
Added: trunk/src/gtk-sat-selector.c
===================================================================
--- trunk/src/gtk-sat-selector.c (rev 0)
+++ trunk/src/gtk-sat-selector.c 2009-08-23 14:22:39 UTC (rev 419)
@@ -0,0 +1,371 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*
+ Gpredict: Real-time satellite tracking and orbit prediction program
+
+ Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+
+ Authors: Alexandru Csete <oz...@gm...>
+
+ Comments, questions and bugreports should be submitted via
+ http://sourceforge.net/projects/gpredict/
+ More details can be found at the project home page:
+
+ http://gpredict.oz9aec.net/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, visit http://www.fsf.org/
+*/
+/** \brief Satellite selector.
+ *
+ * FIXME: add search/lookup function
+ * FIXME: epoch not implemented
+ */
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+#ifdef HAVE_CONFIG_H
+# include <build-config.h>
+#endif
+#include "sat-log.h"
+#include "compat.h"
+#include "gtk-sat-selector.h"
+
+
+
+
+
+
+
+static void gtk_sat_selector_class_init (GtkSatSelectorClass *class);
+static void gtk_sat_selector_init (GtkSatSelector *selector);
+static void gtk_sat_selector_destroy (GtkObject *object);
+
+static void create_and_fill_models (GtkSatSelector *selector);
+
+static gint compare_func (GtkTreeModel *model,
+ GtkTreeIter *a,
+ GtkTreeIter *b,
+ gpointer userdata);
+
+static GtkVBoxClass *parent_class = NULL;
+
+
+GType gtk_sat_selector_get_type ()
+{
+ static GType gtk_sat_selector_type = 0;
+
+ if (!gtk_sat_selector_type)
+ {
+ static const GTypeInfo gtk_sat_selector_info =
+ {
+ sizeof (GtkSatSelectorClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) gtk_sat_selector_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (GtkSatSelector),
+ 1, /* n_preallocs */
+ (GInstanceInitFunc) gtk_sat_selector_init,
+ };
+
+ gtk_sat_selector_type = g_type_register_static (GTK_TYPE_VBOX,
+ "GtkSatSelector",
+ >k_sat_selector_info,
+ 0);
+ }
+
+ return gtk_sat_selector_type;
+}
+
+
+static void gtk_sat_selector_class_init (GtkSatSelectorClass *class)
+{
+ GObjectClass *gobject_class;
+ GtkObjectClass *object_class;
+ GtkWidgetClass *widget_class;
+ GtkContainerClass *container_class;
+
+ gobject_class = G_OBJECT_CLASS (class);
+ object_class = (GtkObjectClass*) class;
+ widget_class = (GtkWidgetClass*) class;
+ container_class = (GtkContainerClass*) class;
+
+ parent_class = g_type_class_peek_parent (class);
+
+ object_class->destroy = gtk_sat_selector_destroy;
+
+}
+
+
+/** \brief Initialise satellite selector widget */
+static void gtk_sat_selector_init (GtkSatSelector *selector)
+{
+ selector->models = NULL;
+}
+
+
+
+/** \brief Clean up memory before destroying satellite selector widget */
+static void gtk_sat_selector_destroy (GtkObject *object)
+{
+ GtkSatSelector *selector = GTK_SAT_SELECTOR (object);
+
+ /* clear list of selected satellites */
+ /* crashes on 2. instance: g_slist_free (sat_tree->selection); */
+ guint n,i;
+ gpointer data;
+
+ n = g_slist_length (selector->models);
+
+ for (i = 0; i < n; i++) {
+ /* get the first element and delete it */
+ data = g_slist_nth_data (selector->models, 0);
+ selector->models = g_slist_remove (selector->models, data);
+ }
+
+
+ (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+}
+
+
+
+/** \brief Create a new GtkSatSelector widget
+ * \param flags Flags indicating which columns should be visible
+ * (see gtk_sat_selector_flag_t)
+ * \return A GtkSatSelector widget.
+ */
+GtkWidget *gtk_sat_selector_new (guint flags)
+{
+ GtkWidget *widget;
+ GtkSatSelector *selector;
+ GtkTreeModel *model;
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+ GtkWidget *hbox;
+ GtkTooltips *tips;
+ GtkWidget *expbut;
+ GtkWidget *colbut;
+
+
+ if (!flags)
+ flags = GTK_SAT_SELECTOR_DEFAULT_FLAGS;
+
+ widget = g_object_new (GTK_TYPE_SAT_SELECTOR, NULL);
+ selector = GTK_SAT_SELECTOR (widget);
+
+ selector->flags = flags;
+
+ /* create list and model */
+ selector->tree = gtk_tree_view_new ();
+ gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (selector->tree), TRUE);
+ create_and_fill_models (selector);
+ model = GTK_TREE_MODEL (g_slist_nth_data (selector->models, 0));
+ gtk_tree_view_set_model (GTK_TREE_VIEW (selector->tree), model);
+ g_object_unref (model);
+
+ /* sort the tree by name */
+ gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (model),
+ GTK_SAT_SELECTOR_COL_NAME,
+ compare_func,
+ NULL,
+ NULL);
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model),
+ GTK_SAT_SELECTOR_COL_NAME,
+ GTK_SORT_ASCENDING);
+
+ /* create tree view columns */
+ /* label column */
+ renderer = gtk_cell_renderer_text_new ();
+ column = gtk_tree_view_column_new_with_attributes (_("Satellite"), renderer,
+ "text", GTK_SAT_SELECTOR_COL_NAME,
+ NULL);
+ gtk_tree_view_insert_column (GTK_TREE_VIEW (selector->tree), column, -1);
+ if (!(flags & GTK_SAT_SELECTOR_FLAG_NAME))
+ gtk_tree_view_column_set_visible (column, FALSE);
+
+ /* catalogue number */
+ renderer = gtk_cell_renderer_text_new ();
+ column = gtk_tree_view_column_new_with_attributes (_("Catnum"), renderer,
+ "text", GTK_SAT_SELECTOR_COL_CATNUM,
+ NULL);
+ gtk_tree_view_insert_column (GTK_TREE_VIEW (selector->tree), column, -1);
+ if (!(flags & GTK_SAT_SELECTOR_FLAG_CATNUM))
+ gtk_tree_view_column_set_visible (column, FALSE);
+
+ /* epoch */
+ renderer = gtk_cell_renderer_text_new ();
+ column = gtk_tree_view_column_new_with_attributes (_("Epoch"), renderer,
+ "text", GTK_SAT_SELECTOR_COL_EPOCH,
+ NULL);
+ gtk_tree_view_insert_column (GTK_TREE_VIEW (selector->tree), column, -1);
+ if (!(flags & GTK_SAT_SELECTOR_FLAG_EPOCH))
+ gtk_tree_view_column_set_visible (column, FALSE);
+
+
+ /* scrolled window */
+ GTK_SAT_SELECTOR (widget)->swin = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (GTK_SAT_SELECTOR (widget)->swin),
+ GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+
+ gtk_container_add (GTK_CONTAINER (GTK_SAT_SELECTOR (widget)->swin),
+ GTK_SAT_SELECTOR (widget)->tree);
+
+ //gtk_container_add (GTK_CONTAINER (widget), GTK_SAT_TREE (widget)->swin);
+ gtk_box_pack_start (GTK_BOX (widget), GTK_SAT_SELECTOR (widget)->swin, TRUE, TRUE, 0);
+
+
+ gtk_widget_show_all (widget);
+
+
+ /* initialise selection */
+ //GTK_SAT_TREE (widget)->selection = NULL;
+
+
+ return widget;
+}
+
+
+
+/** FIXME: flags not needed here */
+static void create_and_fill_models (GtkSatSelector *selector)
+{
+ GtkTreeStore *store; /* the list store data structure */
+ GtkTreeIter node; /* new top level node added to the tree store */
+ GDir *dir;
+ gchar *dirname;
+ gchar *path;
+ gchar *nodename;
+ gchar **buffv;
+ const gchar *fname;
+ guint num = 0;
+
+
+
+
+ /* load all satellites into solector->models[0] */
+
+
+ /* load satellites from each .cat file into selector->models[i] */
+
+#if 0
+ /* create a new tree store */
+ store = gtk_tree_store_new (GTK_SAT_SELECTOR_COL_NUM,
+ G_TYPE_STRING, // name
+ G_TYPE_INT, // catnum
+ G_TYPE_STRING // epoch
+ );
+
+
+ dirname = g_strconcat (g_get_home_dir (),
+ G_DIR_SEPARATOR_S, ".gpredict2",
+ G_DIR_SEPARATOR_S, "tle",
+ NULL);
+
+
+ /* debug message */
+ sat_log_log (SAT_LOG_LEVEL_DEBUG,
+ _("%s:%d: Directory is: %s"),
+ __FILE__, __LINE__, dirname);
+
+ dir = g_dir_open (dirname, 0, NULL);
+
+ /* no tle files */
+ if (!dir) {
+ sat_log_log (SAT_LOG_LEVEL_ERROR,
+ _("%s:%d: No .tle files found in %s."),
+ __FILE__, __LINE__, dirname);
+
+ g_free (dirname);
+
+ return GTK_TREE_MODEL (store);;
+ }
+
+ /* Scan data directory for .tle files.
+ For each file scan through the file and
+ add entry to the tree.
+ */
+ while ((fname = g_dir_read_name (dir))) {
+
+ if (g_strrstr (fname, ".tle")) {
+
+ buffv = g_strsplit (fname, ".tle", 0);
+ nodename = g_strdup (buffv[0]);
+ nodename[0] = g_ascii_toupper (nodename[0]);
+
+ /* create a new top level node in the tree */
+ gtk_tree_store_append (store, &node, NULL);
+ gtk_tree_store_set (store, &node,
+ GTK_SAT_SELECTOR_COL_NAME, nodename,
+ -1);
+
+ /* build full path til file and sweep it for sats */
+ path = g_strconcat (dirname, G_DIR_SEPARATOR_S,
+ fname, NULL);
+
+ num = scan_tle_file (path, store, &node);
+
+ g_free (path);
+ g_free (nodename);
+ g_strfreev (buffv);
+
+ sat_log_log (SAT_LOG_LEVEL_MSG,
+ _("%s:%d: Read %d sats from %s "),
+ __FILE__, __LINE__, num, fname);
+ }
+
+ }
+
+ g_dir_close (dir);
+ g_free (dirname);
+#endif
+
+
+}
+
+
+
+
+
+
+
+
+/** \brief Compare two rows of the GtkSatSelector.
+ * \param model The tree model of the GtkSatSelector.
+ * \param a The first row.
+ * \param b The second row.
+ * \param userdata Not used.
+ *
+ * This function is used by the sorting algorithm to compare two rows of the
+ * GtkSatSelector widget. The unctions works by comparing the character strings
+ * in the name column.
+ */
+static gint compare_func (GtkTreeModel *model,
+ GtkTreeIter *a,
+ GtkTreeIter *b,
+ gpointer userdata)
+{
+ gchar *sat1,*sat2;
+ gint ret = 0;
+
+
+ gtk_tree_model_get(model, a, GTK_SAT_SELECTOR_COL_NAME, &sat1, -1);
+ gtk_tree_model_get(model, b, GTK_SAT_SELECTOR_COL_NAME, &sat2, -1);
+
+ ret = g_ascii_strcasecmp (sat1, sat2);
+
+ g_free (sat1);
+ g_free (sat2);
+
+ return ret;
+}
+
Added: trunk/src/gtk-sat-selector.h
===================================================================
--- trunk/src/gtk-sat-selector.h (rev 0)
+++ trunk/src/gtk-sat-selector.h 2009-08-23 14:22:39 UTC (rev 419)
@@ -0,0 +1,109 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*
+ Gpredict: Real-time satellite tracking and orbit prediction program
+
+ Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+
+ Authors: Alexandru Csete <oz...@gm...>
+
+ Comments, questions and bugreports should be submitted via
+ http://sourceforge.net/projects/gpredict/
+ More details can be found at the project home page:
+
+ http://gpredict.oz9aec.net/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, visit http://www.fsf.org/
+*/
+#ifndef __GTK_SAT_SELECTOR_H__
+#define __GTK_SAT_SELECTOR_H__ 1
+
+#include <gtk/gtk.h>
+//#include "gtk-sat-list.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/** \brief Column definitions in the tree. */
+typedef enum {
+ GTK_SAT_SELECTOR_COL_NAME = 0, /*!< Satellite name. */
+ GTK_SAT_SELECTOR_COL_CATNUM, /*!< Catalogue Number. */
+ GTK_SAT_SELECTOR_COL_EPOCH, /*!< Element set epoch. */
+ GTK_SAT_SELECTOR_COL_NUM /*!< The number of columns. */
+} gtk_sat_selector_col_t;
+
+
+/** \brief Flags used to indicate which columns should be visible. */
+typedef enum {
+ GTK_SAT_SELECTOR_FLAG_NAME = 1 << GTK_SAT_SELECTOR_COL_NAME, /*!< Satellite name. */
+ GTK_SAT_SELECTOR_FLAG_CATNUM = 1 << GTK_SAT_SELECTOR_COL_CATNUM, /*!< Catalogue Number. */
+ GTK_SAT_SELECTOR_FLAG_EPOCH = 1 << GTK_SAT_SELECTOR_COL_EPOCH, /*!< Element set epoch. */
+} gtk_sat_selector_flag_t;
+
+
+
+#define GTK_SAT_SELECTOR_DEFAULT_FLAGS (GTK_SAT_SELECTOR_FLAG_NAME)
+
+
+#define GTK_TYPE_SAT_SELECTOR (gtk_sat_selector_get_type ())
+#define GTK_SAT_SELECTOR(obj) GTK_CHECK_CAST (obj,\
+ gtk_sat_selector_get_type (),\
+ GtkSatSelector)
+
+#define GTK_SAT_SELECTOR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass,\
+ gtk_sat_selector_get_type (),\
+ GtkSatSelectorClass)
+
+#define IS_GTK_SAT_SELECTOR(obj) GTK_CHECK_TYPE (obj, gtk_sat_selector_get_type ())
+
+
+/** \brief The GtkSatSelector structure */
+typedef struct _gtk_sat_selector GtkSatSelector;
+typedef struct _GtkSatSelectorClass GtkSatSelectorClass;
+
+
+/** \brief The GtkSatSelector Structure definition */
+struct _gtk_sat_selector
+{
+ GtkVBox vbox;
+
+ GtkWidget *tree; /*!< The tree. */
+ GtkWidget *swin; /*!< Scrolled window. */
+ guint flags; /*!< Column visibility flags. */
+ GSList *selection; /*!< List of selected satellites. FIXME: remove */
+ gulong handler_id; /*!< Toggle signale handler ID (FIXME): remove. */
+
+ GSList *models;
+};
+
+struct _GtkSatSelectorClass
+{
+ GtkVBoxClass parent_class;
+};
+
+
+GtkType gtk_sat_selector_get_type (void);
+GtkWidget *gtk_sat_selector_new (guint flags);
+guint32 gtk_sat_selector_get_flags (GtkSatSelector *selector);
+//void gtk_sat_selector_select (GtkSatTree *sat_tree, guint catnum);
+guint *gtk_sat_selector_get_selected (GtkSatSelector *selector, gsize *size);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cs...@us...> - 2009-09-23 20:11:25
|
Revision: 425
http://gpredict.svn.sourceforge.net/gpredict/?rev=425&view=rev
Author: csete
Date: 2009-09-23 20:11:17 +0000 (Wed, 23 Sep 2009)
Log Message:
-----------
Changed sat-activated signal to include catalog number in callback.
Modified Paths:
--------------
trunk/src/gtk-sat-selector.c
trunk/src/mod-cfg.c
Modified: trunk/src/gtk-sat-selector.c
===================================================================
--- trunk/src/gtk-sat-selector.c 2009-09-23 19:55:56 UTC (rev 424)
+++ trunk/src/gtk-sat-selector.c 2009-09-23 20:11:17 UTC (rev 425)
@@ -130,9 +130,10 @@
G_STRUCT_OFFSET (GtkSatSelectorClass,gtksatselector),
NULL,
NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE,
- 0);
+ g_cclosure_marshal_VOID__INT,
+ G_TYPE_NONE, // return type
+ 1,
+ G_TYPE_INT); // catnum
}
@@ -570,10 +571,25 @@
GtkTreeViewColumn *column, gpointer data)
{
GtkSatSelector *selector = GTK_SAT_SELECTOR (data);
+ GtkTreeSelection *selection;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gboolean haveselection = FALSE; /* this flag is set to TRUE if there is a selection */
+ gint catnum; /* catalog number of the selected satellite */
- /* emit the "sat-activated" signal for the GtkSatSelector */
- g_signal_emit (G_OBJECT (selector), gtksatsel_signals[SAT_ACTIVATED_SIGNAL], 0);
+ /* get the selected row in the treeview */
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (selector->tree));
+ haveselection = gtk_tree_selection_get_selected (selection, &model, &iter);
+ if (haveselection) {
+ /* get the name and catalog number of the selected saetllite */
+ gtk_tree_model_get (model, &iter,
+ GTK_SAT_SELECTOR_COL_CATNUM, &catnum,
+ -1);
+
+ /* emit the "sat-activated" signal for the GtkSatSelector */
+ g_signal_emit (G_OBJECT (selector), gtksatsel_signals[SAT_ACTIVATED_SIGNAL], 0, catnum);
+ }
}
Modified: trunk/src/mod-cfg.c
===================================================================
--- trunk/src/mod-cfg.c 2009-09-23 19:55:56 UTC (rev 424)
+++ trunk/src/mod-cfg.c 2009-09-23 20:11:17 UTC (rev 425)
@@ -95,7 +95,7 @@
static void edit_advanced_settings (GtkDialog *parent, GKeyFile *cfgdata);
-static void sat_activated_cb (GtkSatSelector *selector, gpointer data);
+static void sat_activated_cb (GtkSatSelector *selector, gint catnr, gpointer data);
/** \brief Create a new module.
@@ -950,18 +950,15 @@
* This function is called when the user has selected (i.e. double clicked) a satellite
* in the GtkSatSelector.
*/
-static void sat_activated_cb (GtkSatSelector *selector, gpointer data)
+static void sat_activated_cb (GtkSatSelector *selector, gint catnr, gpointer data)
{
gchar *satname;
gint catnum;
gdouble epoch;
- /*** FIXME: Change callback to include catnum into callback (for other uses */
gtk_sat_selector_get_selected (selector, &catnum, &satname, &epoch);
- g_print ("===> %s (%d) updated at %.4f\n", satname, catnum, epoch);
-
/* Add satellite to selected list */
g_free (satname);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cs...@us...> - 2009-09-23 22:29:31
|
Revision: 428
http://gpredict.svn.sourceforge.net/gpredict/?rev=428&view=rev
Author: csete
Date: 2009-09-23 22:29:23 +0000 (Wed, 23 Sep 2009)
Log Message:
-----------
Updated.
Modified Paths:
--------------
trunk/src/gtk-sat-selector.c
trunk/src/gtk-sat-selector.h
trunk/src/mod-cfg.c
Modified: trunk/src/gtk-sat-selector.c
===================================================================
--- trunk/src/gtk-sat-selector.c 2009-09-23 20:45:38 UTC (rev 427)
+++ trunk/src/gtk-sat-selector.c 2009-09-23 22:29:23 UTC (rev 428)
@@ -28,7 +28,6 @@
/** \brief Satellite selector.
*
* FIXME: add search/lookup function
- * FIXME: epoch not implemented
*/
#include <gtk/gtk.h>
#include <glib/gi18n.h>
@@ -181,6 +180,7 @@
GtkTreeModel *model;
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
+ GtkWidget *table;
if (!flags)
@@ -226,7 +226,7 @@
/* create tree view columns */
/* label column */
renderer = gtk_cell_renderer_text_new ();
- column = gtk_tree_view_column_new_with_attributes (_("Satellite"), renderer,
+ column = gtk_tree_view_column_new_with_attributes (_("Available Satellites"), renderer,
"text", GTK_SAT_SELECTOR_COL_NAME,
NULL);
gtk_tree_view_insert_column (GTK_TREE_VIEW (selector->tree), column, -1);
@@ -267,10 +267,36 @@
//gtk_container_add (GTK_CONTAINER (widget), GTK_SAT_TREE (widget)->swin);
- gtk_box_pack_start (GTK_BOX (widget), GTK_SAT_SELECTOR (widget)->groups, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (widget), GTK_SAT_SELECTOR (widget)->swin, TRUE, TRUE, 0);
+ //gtk_box_pack_start (GTK_BOX (widget), GTK_SAT_SELECTOR (widget)->groups, FALSE, FALSE, 0);
+ //gtk_box_pack_start (GTK_BOX (widget), GTK_SAT_SELECTOR (widget)->swin, TRUE, TRUE, 0);
+ table = gtk_table_new (5, 2, FALSE);
+ /* Search */
+ gtk_table_attach (GTK_TABLE (table), gtk_label_new (_("Search:")), 0, 1, 0, 1,
+ GTK_SHRINK, GTK_SHRINK, 0, 0);
+ GTK_SAT_SELECTOR (widget)->search = gtk_entry_new ();
+
+ /* this enables automatic search */
+ gtk_tree_view_set_search_entry (GTK_TREE_VIEW (GTK_SAT_SELECTOR (widget)->tree),
+ GTK_ENTRY (GTK_SAT_SELECTOR (widget)->search));
+ gtk_table_attach (GTK_TABLE (table), GTK_SAT_SELECTOR (widget)->search, 1, 2, 0, 1,
+ GTK_FILL, GTK_FILL, 0, 0);
+
+ /* Group selector */
+ gtk_table_attach (GTK_TABLE (table), gtk_label_new (_("Group:")), 0, 1, 1, 2,
+ GTK_SHRINK, GTK_SHRINK, 0, 0);
+ gtk_table_attach (GTK_TABLE (table), GTK_SAT_SELECTOR (widget)->groups, 1, 2, 1, 2,
+ GTK_FILL, GTK_FILL, 0, 0);
+
+
+ /* satellite list */
+ gtk_table_attach (GTK_TABLE (table), GTK_SAT_SELECTOR (widget)->swin, 0, 2, 2, 5,
+ GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0);
+
+ /* Add tabel to main container */
+ gtk_box_pack_start (GTK_BOX (widget), table, TRUE, TRUE, 0);
+
gtk_widget_show_all (widget);
@@ -540,10 +566,20 @@
sel = gtk_combo_box_get_active (combobox);
+ g_print ("%d\n", sel);
+
+ /*** FIXME ***/
+
model = GTK_TREE_MODEL (g_slist_nth_data (selector->models, sel));
gtk_tree_view_set_model (GTK_TREE_VIEW (selector->tree), model);
g_object_unref (model);
+ /* We changed the GtkTreeModel so we need to reset the sort column ID */
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model),
+ GTK_SAT_SELECTOR_COL_NAME,
+ GTK_SORT_ASCENDING);
+
+
}
Modified: trunk/src/gtk-sat-selector.h
===================================================================
--- trunk/src/gtk-sat-selector.h 2009-09-23 20:45:38 UTC (rev 427)
+++ trunk/src/gtk-sat-selector.h 2009-09-23 22:29:23 UTC (rev 428)
@@ -87,6 +87,7 @@
gulong handler_id; /*!< Toggle signale handler ID (FIXME): remove. */
GtkWidget *groups; /*!< Combo box for selecting satellite group. */
+ GtkWidget *search; /*!< Text entry for searching. */
GSList *models; /*!< List of models with index corresponding to groups. */
};
Modified: trunk/src/mod-cfg.c
===================================================================
--- trunk/src/mod-cfg.c 2009-09-23 20:45:38 UTC (rev 427)
+++ trunk/src/mod-cfg.c 2009-09-23 22:29:23 UTC (rev 428)
@@ -78,9 +78,10 @@
/* private widgets */
-static GtkWidget *namew; /* GtkEntry widget for module name */
-static GtkWidget *locw; /* GtkComboBox for location selection */
-static GtkWidget *tree; /* GtkSatTree for selecting satellites */
+static GtkWidget *namew; /* GtkEntry widget for module name */
+static GtkWidget *locw; /* GtkComboBox for location selection */
+static GtkWidget *tree; /* OBSOLETE GtkSatTree for selecting satellites */
+static GtkWidget *satlist; /* list of selected satellites */
/* private functions prototype */
@@ -127,9 +128,9 @@
switch (response) {
/* user pressed OK */
- case GTK_RESPONSE_OK:
+ case GTK_RESPONSE_OK:
- /* check that user has selected at least one satellite */
+ /* FIXME check that user has selected at least one satellite */
sats = gtk_sat_tree_get_selected (GTK_SAT_TREE (tree), &num);
if (num > 0) {
@@ -458,7 +459,7 @@
GtkWidget *table;
GtkWidget *label;
GtkTooltips *tooltips;
- gchar *icon; /* windo icon file name */
+ gchar *icon; /* window icon file name */
@@ -561,7 +562,7 @@
gtk_label_set_markup (GTK_LABEL (label), _("<b>Select Satellites:</b>"));
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), label, FALSE, FALSE, 5);
- /* satellite selector */
+ /* OBSOLETE satellite selector */
tree = gtk_sat_tree_new (0);
if (!new) {
/* select satellites */
@@ -600,7 +601,7 @@
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), tree, TRUE, TRUE, 0);
- /*** EXPERIMENTAL CODE ***/
+ /*** NEW CODE ***/
GtkWidget *selector = gtk_sat_selector_new (0);
g_signal_connect (selector, "sat-activated",
G_CALLBACK (sat_activated_cb), NULL);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cs...@us...> - 2009-09-25 10:47:29
|
Revision: 433
http://gpredict.svn.sourceforge.net/gpredict/?rev=433&view=rev
Author: csete
Date: 2009-09-25 10:47:21 +0000 (Fri, 25 Sep 2009)
Log Message:
-----------
Minor layout and UI tweaks.
Modified Paths:
--------------
trunk/src/gtk-sat-selector.c
trunk/src/mod-cfg.c
Modified: trunk/src/gtk-sat-selector.c
===================================================================
--- trunk/src/gtk-sat-selector.c 2009-09-24 22:41:49 UTC (rev 432)
+++ trunk/src/gtk-sat-selector.c 2009-09-25 10:47:21 UTC (rev 433)
@@ -180,6 +180,7 @@
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
GtkWidget *table;
+ GtkWidget *frame;
if (!flags)
@@ -264,12 +265,19 @@
gtk_container_add (GTK_CONTAINER (GTK_SAT_SELECTOR (widget)->swin),
GTK_SAT_SELECTOR (widget)->tree);
+ /* create a frame around the SWIN */
+ frame = gtk_frame_new (NULL);
+ gtk_container_add (GTK_CONTAINER (frame), GTK_SAT_SELECTOR (widget)->swin);
+
table = gtk_table_new (7, 4, TRUE);
/* Search */
- gtk_table_attach (GTK_TABLE (table), gtk_label_new (_("Search:")), 0, 1, 0, 1,
+ gtk_table_attach (GTK_TABLE (table), gtk_label_new (_("Search")), 0, 1, 0, 1,
GTK_SHRINK, GTK_SHRINK, 0, 0);
GTK_SAT_SELECTOR (widget)->search = gtk_entry_new ();
+ gtk_widget_set_tooltip_text (GTK_SAT_SELECTOR (widget)->search,
+ _("Start typing in this field to search for a satellite"\
+ " in the selected group."));
/* this enables automatic search */
gtk_tree_view_set_search_entry (GTK_TREE_VIEW (GTK_SAT_SELECTOR (widget)->tree),
@@ -278,14 +286,14 @@
GTK_FILL, GTK_FILL, 0, 0);
/* Group selector */
- gtk_table_attach (GTK_TABLE (table), gtk_label_new (_("Group:")), 0, 1, 1, 2,
+ gtk_table_attach (GTK_TABLE (table), gtk_label_new (_("Group")), 0, 1, 1, 2,
GTK_SHRINK, GTK_SHRINK, 0, 0);
gtk_table_attach (GTK_TABLE (table), GTK_SAT_SELECTOR (widget)->groups, 1, 4, 1, 2,
GTK_FILL, GTK_SHRINK, 0, 0);
/* satellite list */
- gtk_table_attach (GTK_TABLE (table), GTK_SAT_SELECTOR (widget)->swin, 0, 4, 2, 7,
+ gtk_table_attach (GTK_TABLE (table), frame, 0, 4, 2, 7,
GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0);
/* Add tabel to main container */
Modified: trunk/src/mod-cfg.c
===================================================================
--- trunk/src/mod-cfg.c 2009-09-24 22:41:49 UTC (rev 432)
+++ trunk/src/mod-cfg.c 2009-09-25 10:47:21 UTC (rev 433)
@@ -25,35 +25,6 @@
You should have received a copy of the GNU General Public License
along with this program; if not, visit http://www.fsf.org/
*/
-/* FIXME: Update diagram
-
-+------------------------------------+
-| +---------------------+ |
-| Name | My Kool Module | |
-| +---------------------+ |
-| +-----------+---+ +---+ |
-| Location | OZ9AEC | v | | + | |
-| +-----------+---+ +---+ |
-| ---------------------------------- |
-| Satellites |
-| +--------------------------+-----+ |
-| | Available Satellites | Sel | |
-| +--------------------------+-----+ |
-| | > Amateur | | |
-| | v Weather | | |
-| | NOAA 14 | x | |
-| | NOAA 15 | x | |
-| | NOAA 17 | x | |
-| | > Military | | |
-| +--------------------------+-----+ |
-| ---------------------------------- |
-| +----------------------+ +------+ |
-| | (not implemented) | | Find | |
-| +----------------------+ +------+ |
-| |
-| Advanced Settings |
-+------------------------------------+
-*/
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include "sat-log.h"
@@ -469,9 +440,11 @@
GtkWidget *addbut, *delbut;
GtkTooltips *tooltips;
gchar *icon; /* window icon file name */
+ GtkWidget *frame;
+
gboolean new = (modname != NULL) ? FALSE : TRUE;
if (new) {
@@ -544,8 +517,9 @@
/* ground station selector */
locw = create_loc_selector (cfgdata);
+ gtk_widget_set_tooltip_text (locw, _("Select a ground station for this module."));
- table = gtk_table_new (2, 3, FALSE);
+ table = gtk_table_new (2, 5, TRUE);
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
gtk_table_set_col_spacings (GTK_TABLE (table), 5);
@@ -559,16 +533,18 @@
gtk_table_attach_defaults (GTK_TABLE (table), locw, 1, 3, 1, 2);
/* add button */
- add = gpredict_hstock_button (GTK_STOCK_ADD, NULL, _("Add new ground station"));
+ add = gpredict_hstock_button (GTK_STOCK_ADD, NULL, _("Add a new ground station"));
g_signal_connect (add, "clicked", G_CALLBACK (add_qth_cb), dialog);
- gtk_table_attach_defaults (GTK_TABLE (table), add, 4, 5, 1, 2);
+ gtk_table_attach (GTK_TABLE (table), add, 3, 4, 1, 2,
+ GTK_SHRINK, GTK_SHRINK, 0, 0);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), table, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
gtk_hseparator_new (), FALSE, FALSE, 5);
label = gtk_label_new (NULL);
- gtk_label_set_markup (GTK_LABEL (label), _("<b>Select Satellites:</b>"));
+ gtk_label_set_markup (GTK_LABEL (label), _("<b>Satellites</b>"));
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), label, FALSE, FALSE, 5);
@@ -591,11 +567,23 @@
_("Remove satellite from the list of selected satellites."));
g_signal_connect (delbut, "clicked", G_CALLBACK (delbut_clicked_cb), NULL);
+ /* quick sat selecotr tutorial label */
+ label = gtk_label_new (NULL);
+ gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_label_set_markup (GTK_LABEL (label),
+ _("<b>Hint: </b> Double click on any satellite\n"\
+ "to move it to the other box."));
+
+ frame = gtk_frame_new (NULL);
+ gtk_container_add (GTK_CONTAINER (frame), swin);
+
table = gtk_table_new (7, 9, TRUE);
gtk_table_attach_defaults (GTK_TABLE (table), selector, 0, 4, 0, 7);
- gtk_table_attach_defaults (GTK_TABLE (table), swin, 5, 9, 2, 7);
+ gtk_table_attach_defaults (GTK_TABLE (table), frame, 5, 9, 2, 7);
gtk_table_attach (GTK_TABLE (table), addbut, 4, 5, 4, 5, GTK_SHRINK, GTK_SHRINK, 2, 5);
gtk_table_attach (GTK_TABLE (table), delbut, 4, 5, 5, 6, GTK_SHRINK, GTK_SHRINK, 2, 5);
+ gtk_table_attach_defaults (GTK_TABLE (table), label, 5, 9, 0, 2);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), table, TRUE, TRUE, 0);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cs...@us...> - 2009-09-27 14:15:20
|
Revision: 442
http://gpredict.svn.sourceforge.net/gpredict/?rev=442&view=rev
Author: csete
Date: 2009-09-27 14:15:02 +0000 (Sun, 27 Sep 2009)
Log Message:
-----------
Updated year.
Modified Paths:
--------------
trunk/src/about.c
trunk/src/about.h
trunk/src/compat.c
trunk/src/compat.h
trunk/src/config-keys.h
trunk/src/defaults.h
trunk/src/first-time.c
trunk/src/first-time.h
trunk/src/gpredict-help.c
trunk/src/gpredict-help.h
trunk/src/gpredict-url-hook.c
trunk/src/gpredict-url-hook.h
trunk/src/gpredict-utils.c
trunk/src/gpredict-utils.h
trunk/src/gtk-azel-plot.c
trunk/src/gtk-azel-plot.h
trunk/src/gtk-freq-knob.c
trunk/src/gtk-freq-knob.h
trunk/src/gtk-polar-plot.c
trunk/src/gtk-polar-plot.h
trunk/src/gtk-polar-view-popup.c
trunk/src/gtk-polar-view-popup.h
trunk/src/gtk-polar-view.c
trunk/src/gtk-polar-view.h
trunk/src/gtk-rig-ctrl.c
trunk/src/gtk-rig-ctrl.h
trunk/src/gtk-rot-ctrl.c
trunk/src/gtk-rot-ctrl.h
trunk/src/gtk-rot-knob.c
trunk/src/gtk-rot-knob.h
trunk/src/gtk-sat-data.c
trunk/src/gtk-sat-data.h
trunk/src/gtk-sat-list-col-sel.c
trunk/src/gtk-sat-list-col-sel.h
trunk/src/gtk-sat-list-popup.c
trunk/src/gtk-sat-list-popup.h
trunk/src/gtk-sat-list.c
trunk/src/gtk-sat-list.h
trunk/src/gtk-sat-map-ground-track.c
trunk/src/gtk-sat-map-ground-track.h
trunk/src/gtk-sat-map-popup.c
trunk/src/gtk-sat-map-popup.h
trunk/src/gtk-sat-map.c
trunk/src/gtk-sat-map.h
trunk/src/gtk-sat-module-popup.c
trunk/src/gtk-sat-module-popup.h
trunk/src/gtk-sat-module-tmg.c
trunk/src/gtk-sat-module-tmg.h
trunk/src/gtk-sat-module.c
trunk/src/gtk-sat-module.h
trunk/src/gtk-sat-selector.c
trunk/src/gtk-sat-selector.h
trunk/src/gtk-sat-tree.c
trunk/src/gtk-sat-tree.h
trunk/src/gtk-single-sat.c
trunk/src/gtk-single-sat.h
trunk/src/gtk-sky-glance.c
trunk/src/gtk-sky-glance.h
trunk/src/gui.c
trunk/src/gui.h
trunk/src/loc-tree.c
trunk/src/loc-tree.h
trunk/src/locator.c
trunk/src/locator.h
trunk/src/main.c
trunk/src/map-selector.c
trunk/src/map-selector.h
trunk/src/menubar.c
trunk/src/menubar.h
trunk/src/mod-cfg-get-param.c
trunk/src/mod-cfg-get-param.h
trunk/src/mod-cfg.c
trunk/src/mod-cfg.h
trunk/src/mod-mgr.c
trunk/src/mod-mgr.h
trunk/src/orbit-tools.c
trunk/src/orbit-tools.h
trunk/src/pass-popup-menu.c
trunk/src/pass-popup-menu.h
trunk/src/pass-to-txt.c
trunk/src/pass-to-txt.h
trunk/src/predict-tools.c
trunk/src/predict-tools.h
trunk/src/qth-data.c
trunk/src/qth-editor.c
trunk/src/qth-editor.h
trunk/src/radio-conf.c
trunk/src/radio-conf.h
trunk/src/rotor-conf.c
trunk/src/rotor-conf.h
trunk/src/sat-cfg.c
trunk/src/sat-cfg.h
trunk/src/sat-info.c
trunk/src/sat-info.h
trunk/src/sat-log-browser.c
trunk/src/sat-log-browser.h
trunk/src/sat-log.c
trunk/src/sat-log.h
trunk/src/sat-monitor.c
trunk/src/sat-monitor.h
trunk/src/sat-pass-dialogs.c
trunk/src/sat-pass-dialogs.h
trunk/src/sat-pref-conditions.c
trunk/src/sat-pref-conditions.h
trunk/src/sat-pref-debug.c
trunk/src/sat-pref-debug.h
trunk/src/sat-pref-formats.c
trunk/src/sat-pref-formats.h
trunk/src/sat-pref-general.c
trunk/src/sat-pref-general.h
trunk/src/sat-pref-help.c
trunk/src/sat-pref-help.h
trunk/src/sat-pref-interfaces.c
trunk/src/sat-pref-interfaces.h
trunk/src/sat-pref-layout.c
trunk/src/sat-pref-layout.h
trunk/src/sat-pref-list-view.c
trunk/src/sat-pref-list-view.h
trunk/src/sat-pref-map-view.c
trunk/src/sat-pref-map-view.h
trunk/src/sat-pref-modules.c
trunk/src/sat-pref-modules.h
trunk/src/sat-pref-multi-pass.c
trunk/src/sat-pref-multi-pass.h
trunk/src/sat-pref-polar-view.c
trunk/src/sat-pref-polar-view.h
trunk/src/sat-pref-predict.c
trunk/src/sat-pref-predict.h
trunk/src/sat-pref-qth-data.h
trunk/src/sat-pref-qth-editor.c
trunk/src/sat-pref-qth-editor.h
trunk/src/sat-pref-qth.c
trunk/src/sat-pref-qth.h
trunk/src/sat-pref-refresh.c
trunk/src/sat-pref-refresh.h
trunk/src/sat-pref-rig-data.h
trunk/src/sat-pref-rig-editor.c
trunk/src/sat-pref-rig-editor.h
trunk/src/sat-pref-rig.c
trunk/src/sat-pref-rig.h
trunk/src/sat-pref-rot-data.h
trunk/src/sat-pref-rot-editor.c
trunk/src/sat-pref-rot-editor.h
trunk/src/sat-pref-rot.c
trunk/src/sat-pref-rot.h
trunk/src/sat-pref-single-pass.c
trunk/src/sat-pref-single-pass.h
trunk/src/sat-pref-single-sat.c
trunk/src/sat-pref-single-sat.h
trunk/src/sat-pref-sky-at-glance.c
trunk/src/sat-pref-sky-at-glance.h
trunk/src/sat-pref-tle.c
trunk/src/sat-pref-tle.h
trunk/src/sat-pref.c
trunk/src/sat-pref.h
trunk/src/sat-vis.c
trunk/src/sat-vis.h
trunk/src/save-pass.c
trunk/src/save-pass.h
trunk/src/time-tools.c
trunk/src/time-tools.h
trunk/src/tle-tools.c
trunk/src/tle-tools.h
trunk/src/tle-update.c
trunk/src/tle-update.h
trunk/src/trsp-conf.c
trunk/src/trsp-conf.h
Modified: trunk/src/about.c
===================================================================
--- trunk/src/about.c 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/about.c 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
@@ -90,7 +90,7 @@
gtk_about_dialog_set_name (GTK_ABOUT_DIALOG (dialog), _("GPREDICT"));
gtk_about_dialog_set_version (GTK_ABOUT_DIALOG (dialog), VERSION);
gtk_about_dialog_set_copyright (GTK_ABOUT_DIALOG (dialog),
- _("Copyright (C) 2001-2008 Alexandru Csete OZ9AEC\n\n"\
+ _("Copyright (C) 2001-2009 Alexandru Csete OZ9AEC\n\n"\
"Gpredict is available free of charge from:"));
gtk_about_dialog_set_url_hook (gpredict_url_hook_cb, NULL, NULL);
gtk_about_dialog_set_website (GTK_ABOUT_DIALOG (dialog),
Modified: trunk/src/about.h
===================================================================
--- trunk/src/about.h 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/about.h 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/compat.c
===================================================================
--- trunk/src/compat.c 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/compat.c 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/compat.h
===================================================================
--- trunk/src/compat.h 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/compat.h 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/config-keys.h
===================================================================
--- trunk/src/config-keys.h 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/config-keys.h 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/defaults.h
===================================================================
--- trunk/src/defaults.h 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/defaults.h 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/first-time.c
===================================================================
--- trunk/src/first-time.c 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/first-time.c 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/first-time.h
===================================================================
--- trunk/src/first-time.h 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/first-time.h 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gpredict-help.c
===================================================================
--- trunk/src/gpredict-help.c 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gpredict-help.c 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gpredict-help.h
===================================================================
--- trunk/src/gpredict-help.h 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gpredict-help.h 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gpredict-url-hook.c
===================================================================
--- trunk/src/gpredict-url-hook.c 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gpredict-url-hook.c 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gpredict-url-hook.h
===================================================================
--- trunk/src/gpredict-url-hook.h 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gpredict-url-hook.h 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gpredict-utils.c
===================================================================
--- trunk/src/gpredict-utils.c 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gpredict-utils.c 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gpredict-utils.h
===================================================================
--- trunk/src/gpredict-utils.h 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gpredict-utils.h 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-azel-plot.c
===================================================================
--- trunk/src/gtk-azel-plot.c 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-azel-plot.c 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-azel-plot.h
===================================================================
--- trunk/src/gtk-azel-plot.h 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-azel-plot.h 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-freq-knob.c
===================================================================
--- trunk/src/gtk-freq-knob.c 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-freq-knob.c 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-freq-knob.h
===================================================================
--- trunk/src/gtk-freq-knob.h 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-freq-knob.h 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-polar-plot.c
===================================================================
--- trunk/src/gtk-polar-plot.c 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-polar-plot.c 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-polar-plot.h
===================================================================
--- trunk/src/gtk-polar-plot.h 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-polar-plot.h 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-polar-view-popup.c
===================================================================
--- trunk/src/gtk-polar-view-popup.c 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-polar-view-popup.c 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-polar-view-popup.h
===================================================================
--- trunk/src/gtk-polar-view-popup.h 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-polar-view-popup.h 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-polar-view.c
===================================================================
--- trunk/src/gtk-polar-view.c 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-polar-view.c 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-polar-view.h
===================================================================
--- trunk/src/gtk-polar-view.h 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-polar-view.h 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-rig-ctrl.c
===================================================================
--- trunk/src/gtk-rig-ctrl.c 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-rig-ctrl.c 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-rig-ctrl.h
===================================================================
--- trunk/src/gtk-rig-ctrl.h 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-rig-ctrl.h 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-rot-ctrl.c
===================================================================
--- trunk/src/gtk-rot-ctrl.c 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-rot-ctrl.c 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-rot-ctrl.h
===================================================================
--- trunk/src/gtk-rot-ctrl.h 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-rot-ctrl.h 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-rot-knob.c
===================================================================
--- trunk/src/gtk-rot-knob.c 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-rot-knob.c 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-rot-knob.h
===================================================================
--- trunk/src/gtk-rot-knob.h 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-rot-knob.h 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-sat-data.c
===================================================================
--- trunk/src/gtk-sat-data.c 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-sat-data.c 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-sat-data.h
===================================================================
--- trunk/src/gtk-sat-data.h 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-sat-data.h 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-sat-list-col-sel.c
===================================================================
--- trunk/src/gtk-sat-list-col-sel.c 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-sat-list-col-sel.c 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-sat-list-col-sel.h
===================================================================
--- trunk/src/gtk-sat-list-col-sel.h 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-sat-list-col-sel.h 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-sat-list-popup.c
===================================================================
--- trunk/src/gtk-sat-list-popup.c 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-sat-list-popup.c 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-sat-list-popup.h
===================================================================
--- trunk/src/gtk-sat-list-popup.h 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-sat-list-popup.h 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-sat-list.c
===================================================================
--- trunk/src/gtk-sat-list.c 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-sat-list.c 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-sat-list.h
===================================================================
--- trunk/src/gtk-sat-list.h 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-sat-list.h 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-sat-map-ground-track.c
===================================================================
--- trunk/src/gtk-sat-map-ground-track.c 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-sat-map-ground-track.c 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-sat-map-ground-track.h
===================================================================
--- trunk/src/gtk-sat-map-ground-track.h 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-sat-map-ground-track.h 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-sat-map-popup.c
===================================================================
--- trunk/src/gtk-sat-map-popup.c 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-sat-map-popup.c 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-sat-map-popup.h
===================================================================
--- trunk/src/gtk-sat-map-popup.h 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-sat-map-popup.h 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-sat-map.c
===================================================================
--- trunk/src/gtk-sat-map.c 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-sat-map.c 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Copyright (C) 2006-2007 William J Beksi, KC2EXL.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-sat-map.h
===================================================================
--- trunk/src/gtk-sat-map.h 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-sat-map.h 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Copyright (C) 2006-2007 William J Beksi, KC2EXL.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-sat-module-popup.c
===================================================================
--- trunk/src/gtk-sat-module-popup.c 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-sat-module-popup.c 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-sat-module-popup.h
===================================================================
--- trunk/src/gtk-sat-module-popup.h 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-sat-module-popup.h 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-sat-module-tmg.c
===================================================================
--- trunk/src/gtk-sat-module-tmg.c 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-sat-module-tmg.c 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-sat-module-tmg.h
===================================================================
--- trunk/src/gtk-sat-module-tmg.h 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-sat-module-tmg.h 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-sat-module.c
===================================================================
--- trunk/src/gtk-sat-module.c 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/src/gtk-sat-module.c 2009-09-27 14:15:02 UTC (rev 442)
@@ -2,7 +2,7 @@
/*
Gpredict: Real-time satellite tracking and orbit prediction program
- Copyright (C) 2001-2008 Alexandru Csete, OZ9AEC.
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
Authors: Alexandru Csete <oz...@gm...>
Modified: trunk/src/gtk-sat-module.h
===================================================================
--- trunk/src/gtk-sat-module.h 2009-09-27 13:45:38 UTC (rev 441)
+++ trunk/sr...
[truncated message content] |
|
From: <cs...@us...> - 2009-09-27 16:03:27
|
Revision: 445
http://gpredict.svn.sourceforge.net/gpredict/?rev=445&view=rev
Author: csete
Date: 2009-09-27 16:03:19 +0000 (Sun, 27 Sep 2009)
Log Message:
-----------
Addd configuration flag for automatically showing the sky tracks in the Polar views.
Modified Paths:
--------------
trunk/src/sat-cfg.c
trunk/src/sat-cfg.h
Modified: trunk/src/sat-cfg.c
===================================================================
--- trunk/src/sat-cfg.c 2009-09-27 15:45:35 UTC (rev 444)
+++ trunk/src/sat-cfg.c 2009-09-27 16:03:19 UTC (rev 445)
@@ -130,6 +130,7 @@
{ "MODULES", "POLAR_NEXT_EVENT", TRUE},
{ "MODULES", "POLAR_CURSOR_TRACK", TRUE},
{ "MODULES", "POLAR_EXTRA_AZ_TICKS", FALSE},
+ { "MODULES", "POLAR_SHOW_TRACK_AUTO", FALSE},
{ "TLE", "SERVER_AUTH", FALSE},
{ "TLE", "PROXY_AUTH", FALSE},
{ "TLE", "ADD_NEW_SATS", TRUE},
Modified: trunk/src/sat-cfg.h
===================================================================
--- trunk/src/sat-cfg.h 2009-09-27 15:45:35 UTC (rev 444)
+++ trunk/src/sat-cfg.h 2009-09-27 16:03:19 UTC (rev 445)
@@ -51,6 +51,7 @@
SAT_CFG_BOOL_POL_SHOW_NEXT_EV, /*!< Show next event on polar plot */
SAT_CFG_BOOL_POL_SHOW_CURS_TRACK, /*!< Track mouse cursor on polar plot. */
SAT_CFG_BOOL_POL_SHOW_EXTRA_AZ_TICKS, /*!< Extra Az ticks at every 30 deg. */
+ SAT_CFG_BOOL_POL_SHOW_TRACK_AUTO, /*!< Automatically show the sky track. */
SAT_CFG_BOOL_TLE_SERVER_AUTH, /*!< TLE server requires authentication. */
SAT_CFG_BOOL_TLE_PROXY_AUTH, /*!< Proxy requires authentication. */
SAT_CFG_BOOL_TLE_ADD_NEW, /*!< Add new satellites to database. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cs...@us...> - 2009-09-27 16:22:01
|
Revision: 447
http://gpredict.svn.sourceforge.net/gpredict/?rev=447&view=rev
Author: csete
Date: 2009-09-27 16:21:46 +0000 (Sun, 27 Sep 2009)
Log Message:
-----------
Added support for automatically showing the sky tracks.
Modified Paths:
--------------
trunk/src/gtk-polar-view.c
trunk/src/gtk-polar-view.h
Modified: trunk/src/gtk-polar-view.c
===================================================================
--- trunk/src/gtk-polar-view.c 2009-09-27 16:15:21 UTC (rev 446)
+++ trunk/src/gtk-polar-view.c 2009-09-27 16:21:46 UTC (rev 447)
@@ -64,6 +64,7 @@
gpointer data);
static void update_sat (gpointer key, gpointer value, gpointer data);
static void update_track (gpointer key, gpointer value, gpointer data);
+static void create_track (GtkPolarView *pv, sat_obj_t *obj, sat_t *sat);
static void correct_pole_coor (GtkPolarView *polv, polar_view_pole_t pole,
gfloat *x, gfloat *y, GtkAnchorType *anch);
static gboolean on_motion_notify (GooCanvasItem *item,
@@ -200,6 +201,12 @@
MOD_CFG_POLAR_REFRESH,
SAT_CFG_INT_POLAR_REFRESH);
+ GTK_POLAR_VIEW (polv)->showtrack = mod_cfg_get_bool (cfgdata,
+ MOD_CFG_POLAR_SECTION,
+ MOD_CFG_POLAR_SHOW_TRACK_AUTO,
+ SAT_CFG_BOOL_POL_SHOW_TRACK_AUTO);
+
+
GTK_POLAR_VIEW (polv)->counter = 1;
GTK_POLAR_VIEW (polv)->swap = mod_cfg_get_int (cfgdata,
@@ -281,6 +288,7 @@
MOD_CFG_POLAR_AXIS_COL,
SAT_CFG_INT_POLAR_AXIS_COL);
+
/* Add elevation circles at 0, 30 and 60 deg */
polv->C00 = goo_canvas_ellipse_model_new (root,
polv->cx, polv->cy,
@@ -938,7 +946,7 @@
/* add sat to canvas */
obj = g_try_new (sat_obj_t, 1);
obj->selected = FALSE;
- obj->showtrack = FALSE;
+ obj->showtrack = polv->showtrack;
obj->istarget = FALSE;
root = goo_canvas_get_root_item_model (GOO_CANVAS (polv->canvas));
@@ -976,6 +984,10 @@
/* add sat to hash table */
g_hash_table_insert (polv->obj, catnum, obj);
+
+ /* Finally, create the sky track if necessary */
+ if (obj->showtrack)
+ create_track (polv, obj, sat);
}
}
@@ -1046,6 +1058,151 @@
}
+/**** FIXME: DUPLICATE from gtk-polar-view-popup.c - needed by create_track ******/
+static GooCanvasItemModel *create_time_tick (GtkPolarView *pv, gdouble time, gfloat x, gfloat y)
+{
+ GooCanvasItemModel *item;
+ time_t t;
+ gchar buff[7];
+ GtkAnchorType anchor;
+ GooCanvasItemModel *root;
+ guint32 col;
+
+ root = goo_canvas_get_root_item_model (GOO_CANVAS (pv->canvas));
+
+ col = mod_cfg_get_int (pv->cfgdata,
+ MOD_CFG_POLAR_SECTION,
+ MOD_CFG_POLAR_TRACK_COL,
+ SAT_CFG_INT_POLAR_TRACK_COL);
+
+ /* convert julian date to struct tm */
+ t = (time - 2440587.5)*86400.;
+
+ /* format either local time or UTC depending on check box */
+ if (sat_cfg_get_bool (SAT_CFG_BOOL_USE_LOCAL_TIME))
+ strftime (buff, 8, "%H:%M", localtime (&t));
+ else
+ strftime (buff, 8, "%H:%M", gmtime (&t));
+
+ buff[6]='\0';
+
+ if (x > pv->cx) {
+ anchor = GTK_ANCHOR_EAST;
+ x -= 5;
+ }
+ else {
+ anchor = GTK_ANCHOR_WEST;
+ x += 5;
+ }
+
+ item = goo_canvas_text_model_new (root, buff,
+ (gdouble) x, (gdouble) y,
+ -1, anchor,
+ "font", "Sans 7",
+ "fill-color-rgba", col,
+ NULL);
+
+ goo_canvas_item_model_lower (item, NULL);
+
+ return item;
+}
+
+/** \brief Create a sky track for a satellite.
+ * \param pv Pointer to the GtkPolarView object.
+ * \param obj Pointer to the sat_obj_t object.
+ * \param sat Pointer to the sat_t object.
+ *
+ * Note: This function is only used when the the satellite comes within range
+ * and the ALWAYS_SHOW_SKY_TRACK option is TRUE.
+ */
+static void create_track (GtkPolarView *pv, sat_obj_t *obj, sat_t *sat)
+{
+ gint i;
+ GooCanvasItemModel *root;
+ pass_detail_t *detail;
+ guint num;
+ GooCanvasPoints *points;
+ gfloat x,y;
+ guint32 col;
+ guint tres,ttidx;
+
+
+ /* get satellite object */
+ /*obj = SAT_OBJ(g_object_get_data (G_OBJECT (item), "obj"));
+ sat = SAT(g_object_get_data (G_OBJECT (item), "sat"));
+ qth = (qth_t *)(g_object_get_data (G_OBJECT (item), "qth"));*/
+
+ if (obj == NULL) {
+ sat_log_log (SAT_LOG_LEVEL_BUG,
+ _("%s:%d: Failed to get satellite object."),
+ __FILE__, __LINE__);
+ return;
+ }
+
+ root = goo_canvas_get_root_item_model (GOO_CANVAS (pv->canvas));
+
+ /* add sky track */
+
+ /* create points */
+ num = g_slist_length (obj->pass->details);
+
+ /* time resolution for time ticks; we need
+ 3 additional points to AOS and LOS ticks.
+ */
+ tres = (num-2) / (TRACK_TICK_NUM-1);
+
+ points = goo_canvas_points_new (num);
+
+ /* first point should be (aos_az,0.0) */
+ azel_to_xy (pv, obj->pass->aos_az, 0.0, &x, &y);
+ points->coords[0] = (double) x;
+ points->coords[1] = (double) y;
+ obj->trtick[0] = create_time_tick (pv, obj->pass->aos, x, y);
+
+ ttidx = 1;
+
+ for (i = 1; i < num-1; i++) {
+ detail = PASS_DETAIL(g_slist_nth_data (obj->pass->details, i));
+ azel_to_xy (pv, detail->az, detail->el, &x, &y);
+ points->coords[2*i] = (double) x;
+ points->coords[2*i+1] = (double) y;
+
+ if (!(i % tres)) {
+ /* create a time tick */
+ obj->trtick[ttidx] = create_time_tick (pv, detail->time, x, y);
+ ttidx++;
+ }
+ }
+
+ /* last point should be (los_az, 0.0) */
+ azel_to_xy (pv, obj->pass->los_az, 0.0, &x, &y);
+ points->coords[2*(num-1)] = (double) x;
+ points->coords[2*(num-1)+1] = (double) y;
+
+ /* create poly-line */
+ col = mod_cfg_get_int (pv->cfgdata,
+ MOD_CFG_POLAR_SECTION,
+ MOD_CFG_POLAR_TRACK_COL,
+ SAT_CFG_INT_POLAR_TRACK_COL);
+
+ obj->track = goo_canvas_polyline_model_new (root, FALSE, 0,
+ "points", points,
+ "line-width", 1.0,
+ "stroke-color-rgba", col,
+ "line-cap", CAIRO_LINE_CAP_SQUARE,
+ "line-join", CAIRO_LINE_JOIN_MITER,
+ NULL);
+ goo_canvas_points_unref (points);
+
+ /* put track on the bottom of the sack */
+ goo_canvas_item_model_lower (obj->track, NULL);
+
+}
+
+
+
+
+
/** \brief Convert Az/El to canvas based XY coordinates. */
void
azel_to_xy (GtkPolarView *p, gdouble az, gdouble el, gfloat *x, gfloat *y)
Modified: trunk/src/gtk-polar-view.h
===================================================================
--- trunk/src/gtk-polar-view.h 2009-09-27 16:15:21 UTC (rev 446)
+++ trunk/src/gtk-polar-view.h 2009-09-27 16:21:46 UTC (rev 447)
@@ -130,6 +130,7 @@
gboolean eventinfo; /*!< Show info about the next event. */
gboolean cursinfo; /*!< Track the mouse cursor. */
gboolean extratick; /*!< Show extra ticks */
+ gboolean showtrack; /*!< Automatically show sky tracks. */
gboolean resize; /*!< Flag indicating that the view has been resized. */
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cs...@us...> - 2009-09-28 15:41:08
|
Revision: 455
http://gpredict.svn.sourceforge.net/gpredict/?rev=455&view=rev
Author: csete
Date: 2009-09-28 15:41:01 +0000 (Mon, 28 Sep 2009)
Log Message:
-----------
Fixed indent.
Modified Paths:
--------------
trunk/src/gtk-polar-plot.c
trunk/src/gtk-polar-plot.h
trunk/src/gtk-rot-ctrl.c
Modified: trunk/src/gtk-polar-plot.c
===================================================================
--- trunk/src/gtk-polar-plot.c 2009-09-28 15:23:15 UTC (rev 454)
+++ trunk/src/gtk-polar-plot.c 2009-09-28 15:41:01 UTC (rev 455)
@@ -11,7 +11,7 @@
More details can be found at the project home page:
http://gpredict.oz9aec.net/
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
@@ -68,21 +68,21 @@
static void gtk_polar_plot_init (GtkPolarPlot *polview);
static void gtk_polar_plot_destroy (GtkObject *object);
static void size_allocate_cb (GtkWidget *widget,
- GtkAllocation *allocation,
- gpointer data);
+ GtkAllocation *allocation,
+ gpointer data);
static void create_track (GtkPolarPlot *pv);
static void update_track (GtkPolarPlot *pv);
static GooCanvasItemModel *create_time_tick (GtkPolarPlot *pv, gdouble time, gfloat x, gfloat y);
static void correct_pole_coor (GtkPolarPlot *polv, polar_plot_pole_t pole,
- gfloat *x, gfloat *y, GtkAnchorType *anch);
+ gfloat *x, gfloat *y, GtkAnchorType *anch);
static gboolean on_motion_notify (GooCanvasItem *item,
- GooCanvasItem *target,
- GdkEventMotion *event,
- gpointer data);
+ GooCanvasItem *target,
+ GdkEventMotion *event,
+ gpointer data);
static void on_item_created (GooCanvas *canvas,
- GooCanvasItem *item,
- GooCanvasItemModel *model,
- gpointer data);
+ GooCanvasItem *item,
+ GooCanvasItemModel *model,
+ gpointer data);
static void on_canvas_realized (GtkWidget *canvas, gpointer data);
static GooCanvasItemModel* create_canvas_model (GtkPolarPlot *polv);
static void get_canvas_bg_color (GtkPolarPlot *polv, GdkColor *color);
@@ -94,72 +94,72 @@
GtkType
-gtk_polar_plot_get_type ()
+ gtk_polar_plot_get_type ()
{
- static GType gtk_polar_plot_type = 0;
+ static GType gtk_polar_plot_type = 0;
- if (!gtk_polar_plot_type) {
- static const GTypeInfo gtk_polar_plot_info = {
- sizeof (GtkPolarPlotClass),
- NULL, /* base init */
- NULL, /* base finalise */
- (GClassInitFunc) gtk_polar_plot_class_init,
- NULL, /* class finalise */
- NULL, /* class data */
- sizeof (GtkPolarPlot),
- 5, /* n_preallocs */
- (GInstanceInitFunc) gtk_polar_plot_init,
- };
+ if (!gtk_polar_plot_type) {
+ static const GTypeInfo gtk_polar_plot_info = {
+ sizeof (GtkPolarPlotClass),
+ NULL, /* base init */
+ NULL, /* base finalise */
+ (GClassInitFunc) gtk_polar_plot_class_init,
+ NULL, /* class finalise */
+ NULL, /* class data */
+ sizeof (GtkPolarPlot),
+ 5, /* n_preallocs */
+ (GInstanceInitFunc) gtk_polar_plot_init,
+ };
- gtk_polar_plot_type = g_type_register_static (GTK_TYPE_VBOX,
- "GtkPolarPlot",
- >k_polar_plot_info,
- 0);
- }
+ gtk_polar_plot_type = g_type_register_static (GTK_TYPE_VBOX,
+ "GtkPolarPlot",
+ >k_polar_plot_info,
+ 0);
+ }
- return gtk_polar_plot_type;
+ return gtk_polar_plot_type;
}
static void
-gtk_polar_plot_class_init (GtkPolarPlotClass *class)
+ gtk_polar_plot_class_init (GtkPolarPlotClass *class)
{
- GObjectClass *gobject_class;
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
+ GObjectClass *gobject_class;
+ GtkObjectClass *object_class;
+ GtkWidgetClass *widget_class;
+ GtkContainerClass *container_class;
- gobject_class = G_OBJECT_CLASS (class);
- object_class = (GtkObjectClass*) class;
- widget_class = (GtkWidgetClass*) class;
- container_class = (GtkContainerClass*) class;
+ gobject_class = G_OBJECT_CLASS (class);
+ object_class = (GtkObjectClass*) class;
+ widget_class = (GtkWidgetClass*) class;
+ container_class = (GtkContainerClass*) class;
- parent_class = g_type_class_peek_parent (class);
+ parent_class = g_type_class_peek_parent (class);
- object_class->destroy = gtk_polar_plot_destroy;
- //widget_class->size_allocate = gtk_polar_plot_size_allocate;
+ object_class->destroy = gtk_polar_plot_destroy;
+ //widget_class->size_allocate = gtk_polar_plot_size_allocate;
}
static void
-gtk_polar_plot_init (GtkPolarPlot *polview)
+ gtk_polar_plot_init (GtkPolarPlot *polview)
{
- polview->qth = NULL;
+ polview->qth = NULL;
polview->pass = NULL;
- polview->size = 0;
- polview->r = 0;
- polview->cx = 0;
- polview->cy = 0;
- polview->swap = 0;
- polview->qthinfo = FALSE;
- polview->cursinfo = FALSE;
- polview->extratick = FALSE;
+ polview->size = 0;
+ polview->r = 0;
+ polview->cx = 0;
+ polview->cy = 0;
+ polview->swap = 0;
+ polview->qthinfo = FALSE;
+ polview->cursinfo = FALSE;
+ polview->extratick = FALSE;
polview->target = NULL;
}
static void
-gtk_polar_plot_destroy (GtkObject *object)
+ gtk_polar_plot_destroy (GtkObject *object)
{
if (GTK_POLAR_PLOT (object)->pass != NULL) {
@@ -167,7 +167,7 @@
GTK_POLAR_PLOT (object)->pass = NULL;
}
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+ (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
@@ -178,57 +178,57 @@
*
*/
GtkWidget*
-gtk_polar_plot_new (qth_t *qth, pass_t *pass)
+ gtk_polar_plot_new (qth_t *qth, pass_t *pass)
{
- GtkWidget *polv;
- GooCanvasItemModel *root;
- GdkColor bg_color = {0, 0xFFFF, 0xFFFF, 0xFFFF};
+ GtkWidget *polv;
+ GooCanvasItemModel *root;
+ GdkColor bg_color = {0, 0xFFFF, 0xFFFF, 0xFFFF};
- polv = g_object_new (GTK_TYPE_POLAR_PLOT, NULL);
+ polv = g_object_new (GTK_TYPE_POLAR_PLOT, NULL);
- GTK_POLAR_PLOT (polv)->qth = qth;
+ GTK_POLAR_PLOT (polv)->qth = qth;
if (pass != NULL)
GTK_POLAR_PLOT (polv)->pass = copy_pass (pass);
- /* get settings */
- GTK_POLAR_PLOT (polv)->swap = sat_cfg_get_int (SAT_CFG_INT_POLAR_ORIENTATION);
- GTK_POLAR_PLOT (polv)->qthinfo = sat_cfg_get_bool (SAT_CFG_BOOL_POL_SHOW_QTH_INFO);
- GTK_POLAR_PLOT (polv)->extratick = sat_cfg_get_bool (SAT_CFG_BOOL_POL_SHOW_EXTRA_AZ_TICKS);
- GTK_POLAR_PLOT (polv)->cursinfo = TRUE;
+ /* get settings */
+ GTK_POLAR_PLOT (polv)->swap = sat_cfg_get_int (SAT_CFG_INT_POLAR_ORIENTATION);
+ GTK_POLAR_PLOT (polv)->qthinfo = sat_cfg_get_bool (SAT_CFG_BOOL_POL_SHOW_QTH_INFO);
+ GTK_POLAR_PLOT (polv)->extratick = sat_cfg_get_bool (SAT_CFG_BOOL_POL_SHOW_EXTRA_AZ_TICKS);
+ GTK_POLAR_PLOT (polv)->cursinfo = TRUE;
- /* create the canvas */
- GTK_POLAR_PLOT (polv)->canvas = goo_canvas_new ();
- get_canvas_bg_color (GTK_POLAR_PLOT (polv), &bg_color);
- gtk_widget_modify_base (GTK_POLAR_PLOT (polv)->canvas, GTK_STATE_NORMAL, &bg_color);
- gtk_widget_set_size_request (GTK_POLAR_PLOT (polv)->canvas,
- POLV_DEFAULT_SIZE, POLV_DEFAULT_SIZE);
- goo_canvas_set_bounds (GOO_CANVAS (GTK_POLAR_PLOT (polv)->canvas), 0, 0,
- POLV_DEFAULT_SIZE, POLV_DEFAULT_SIZE);
+ /* create the canvas */
+ GTK_POLAR_PLOT (polv)->canvas = goo_canvas_new ();
+ get_canvas_bg_color (GTK_POLAR_PLOT (polv), &bg_color);
+ gtk_widget_modify_base (GTK_POLAR_PLOT (polv)->canvas, GTK_STATE_NORMAL, &bg_color);
+ gtk_widget_set_size_request (GTK_POLAR_PLOT (polv)->canvas,
+ POLV_DEFAULT_SIZE, POLV_DEFAULT_SIZE);
+ goo_canvas_set_bounds (GOO_CANVAS (GTK_POLAR_PLOT (polv)->canvas), 0, 0,
+ POLV_DEFAULT_SIZE, POLV_DEFAULT_SIZE);
- /* connect size-request signal */
- g_signal_connect (GTK_POLAR_PLOT (polv)->canvas, "size-allocate",
- G_CALLBACK (size_allocate_cb), polv);
- g_signal_connect (GTK_POLAR_PLOT (polv)->canvas, "item_created",
- (GtkSignalFunc) on_item_created, polv);
- g_signal_connect_after (GTK_POLAR_PLOT (polv)->canvas, "realize",
- (GtkSignalFunc) on_canvas_realized, polv);
+ /* connect size-request signal */
+ g_signal_connect (GTK_POLAR_PLOT (polv)->canvas, "size-allocate",
+ G_CALLBACK (size_allocate_cb), polv);
+ g_signal_connect (GTK_POLAR_PLOT (polv)->canvas, "item_created",
+ (GtkSignalFunc) on_item_created, polv);
+ g_signal_connect_after (GTK_POLAR_PLOT (polv)->canvas, "realize",
+ (GtkSignalFunc) on_canvas_realized, polv);
- gtk_widget_show (GTK_POLAR_PLOT (polv)->canvas);
+ gtk_widget_show (GTK_POLAR_PLOT (polv)->canvas);
- /* Create the canvas model */
- root = create_canvas_model (GTK_POLAR_PLOT (polv));
- goo_canvas_set_root_item_model (GOO_CANVAS (GTK_POLAR_PLOT (polv)->canvas), root);
+ /* Create the canvas model */
+ root = create_canvas_model (GTK_POLAR_PLOT (polv));
+ goo_canvas_set_root_item_model (GOO_CANVAS (GTK_POLAR_PLOT (polv)->canvas), root);
- g_object_unref (root);
+ g_object_unref (root);
if (GTK_POLAR_PLOT (polv)->pass != NULL) {
- create_track (GTK_POLAR_PLOT (polv));
+ create_track (GTK_POLAR_PLOT (polv));
}
- gtk_container_add (GTK_CONTAINER (polv), GTK_POLAR_PLOT (polv)->canvas);
+ gtk_container_add (GTK_CONTAINER (polv), GTK_POLAR_PLOT (polv)->canvas);
- return polv;
+ return polv;
}
@@ -377,11 +377,11 @@
/* the target object does not exist; create it */
col = sat_cfg_get_int (SAT_CFG_INT_POLAR_SAT_COL);
plot->ctrl = goo_canvas_ellipse_model_new (root,
- x, y, 7, 7,
- "fill-color-rgba", 0xFF00000F,
- "stroke-color-rgba", col,
- "line-width", 0.8,
- NULL);
+ x, y, 7, 7,
+ "fill-color-rgba", 0xFF00000F,
+ "stroke-color-rgba", col,
+ "line-width", 0.8,
+ NULL);
}
}
@@ -465,11 +465,11 @@
else {
/* the target object does not exist; create it */
plot->rot1 = goo_canvas_polyline_model_new_line (root,
- x, y-4, x, y-14,
- "fill-color-rgba", col,
- "stroke-color-rgba", col,
- "line-width", 1.0,
- NULL);
+ x, y-4, x, y-14,
+ "fill-color-rgba", col,
+ "stroke-color-rgba", col,
+ "line-width", 1.0,
+ NULL);
}
if (plot->rot2 != NULL) {
/* the target object already exists; move it */
@@ -486,11 +486,11 @@
else {
/* the target object does not exist; create it */
plot->rot2 = goo_canvas_polyline_model_new_line (root,
- x+4, y, x+14, y,
- "fill-color-rgba", col,
- "stroke-color-rgba", col,
- "line-width", 1.0,
- NULL);
+ x+4, y, x+14, y,
+ "fill-color-rgba", col,
+ "stroke-color-rgba", col,
+ "line-width", 1.0,
+ NULL);
}
if (plot->rot3 != NULL) {
/* the target object already exists; move it */
@@ -507,11 +507,11 @@
else {
/* the target object does not exist; create it */
plot->rot3 = goo_canvas_polyline_model_new_line (root,
- x, y+4, x, y+14,
- "fill-color-rgba", col,
- "stroke-color-rgba", col,
- "line-width", 1.0,
- NULL);
+ x, y+4, x, y+14,
+ "fill-color-rgba", col,
+ "stroke-color-rgba", col,
+ "line-width", 1.0,
+ NULL);
}
if (plot->rot4 != NULL) {
/* the target object already exists; move it */
@@ -528,11 +528,11 @@
else {
/* the target object does not exist; create it */
plot->rot4 = goo_canvas_polyline_model_new_line (root,
- x-4, y, x-14, y,
- "fill-color-rgba", col,
- "stroke-color-rgba", col,
- "line-width", 1.0,
- NULL);
+ x-4, y, x-14, y,
+ "fill-color-rgba", col,
+ "stroke-color-rgba", col,
+ "line-width", 1.0,
+ NULL);
}
}
@@ -552,131 +552,131 @@
static GooCanvasItemModel *
-create_canvas_model (GtkPolarPlot *polv)
+ create_canvas_model (GtkPolarPlot *polv)
{
- GooCanvasItemModel *root;
- gfloat x,y;
- guint32 col;
- GtkAnchorType anch = GTK_ANCHOR_CENTER;
+ GooCanvasItemModel *root;
+ gfloat x,y;
+ guint32 col;
+ GtkAnchorType anch = GTK_ANCHOR_CENTER;
- root = goo_canvas_group_model_new (NULL, NULL);
+ root = goo_canvas_group_model_new (NULL, NULL);
- /* graph dimensions */
- polv->size = POLV_DEFAULT_SIZE;
- polv->r = (polv->size / 2) - POLV_DEFAULT_MARGIN;
- polv->cx = POLV_DEFAULT_SIZE / 2;
- polv->cy = POLV_DEFAULT_SIZE / 2;
+ /* graph dimensions */
+ polv->size = POLV_DEFAULT_SIZE;
+ polv->r = (polv->size / 2) - POLV_DEFAULT_MARGIN;
+ polv->cx = POLV_DEFAULT_SIZE / 2;
+ polv->cy = POLV_DEFAULT_SIZE / 2;
- col = sat_cfg_get_int (SAT_CFG_INT_POLAR_AXIS_COL);
+ col = sat_cfg_get_int (SAT_CFG_INT_POLAR_AXIS_COL);
- /* Add elevation circles at 0, 30 and 60 deg */
- polv->C00 = goo_canvas_ellipse_model_new (root,
- polv->cx, polv->cy,
- polv->r, polv->r,
- "line-width", 1.0,
- "stroke-color-rgba", col,
- NULL);
+ /* Add elevation circles at 0, 30 and 60 deg */
+ polv->C00 = goo_canvas_ellipse_model_new (root,
+ polv->cx, polv->cy,
+ polv->r, polv->r,
+ "line-width", 1.0,
+ "stroke-color-rgba", col,
+ NULL);
- polv->C30 = goo_canvas_ellipse_model_new (root,
- polv->cx, polv->cy,
- 0.6667 * polv->r, 0.6667 * polv->r,
- "line-width", 1.0,
- "stroke-color-rgba", col,
- NULL);
+ polv->C30 = goo_canvas_ellipse_model_new (root,
+ polv->cx, polv->cy,
+ 0.6667 * polv->r, 0.6667 * polv->r,
+ "line-width", 1.0,
+ "stroke-color-rgba", col,
+ NULL);
- polv->C60 = goo_canvas_ellipse_model_new (root,
- polv->cx, polv->cy,
- 0.333 * polv->r, 0.3333 * polv->r,
- "line-width", 1.0,
- "stroke-color-rgba", col,
- NULL);
+ polv->C60 = goo_canvas_ellipse_model_new (root,
+ polv->cx, polv->cy,
+ 0.333 * polv->r, 0.3333 * polv->r,
+ "line-width", 1.0,
+ "stroke-color-rgba", col,
+ NULL);
- /* add horixontal and vertical guidance lines */
- polv->hl = goo_canvas_polyline_model_new_line (root,
- polv->cx - polv->r - POLV_LINE_EXTRA,
- polv->cy,
- polv->cx + polv->r + POLV_LINE_EXTRA,
- polv->cy,
- "stroke-color-rgba", col,
- "line-width", 1.0,
- NULL);
- polv->vl = goo_canvas_polyline_model_new_line (root,
- polv->cx,
- polv->cy - polv->r - POLV_LINE_EXTRA,
- polv->cx,
- polv->cy + polv->r + POLV_LINE_EXTRA,
- "stroke-color-rgba", col,
- "line-width", 1.0,
- NULL);
+ /* add horixontal and vertical guidance lines */
+ polv->hl = goo_canvas_polyline_model_new_line (root,
+ polv->cx - polv->r - POLV_LINE_EXTRA,
+ polv->cy,
+ polv->cx + polv->r + POLV_LINE_EXTRA,
+ polv->cy,
+ "stroke-color-rgba", col,
+ "line-width", 1.0,
+ NULL);
+ polv->vl = goo_canvas_polyline_model_new_line (root,
+ polv->cx,
+ polv->cy - polv->r - POLV_LINE_EXTRA,
+ polv->cx,
+ polv->cy + polv->r + POLV_LINE_EXTRA,
+ "stroke-color-rgba", col,
+ "line-width", 1.0,
+ NULL);
- /* N, S, E and W labels. */
- col = sat_cfg_get_int (SAT_CFG_INT_POLAR_TICK_COL);
- azel_to_xy (polv, 0.0, 0.0, &x, &y);
- correct_pole_coor (polv, POLAR_PLOT_POLE_N, &x, &y, &anch);
- polv->N = goo_canvas_text_model_new (root, _("N"),
- x,
- y,
- -1,
- anch,
- "font", "Sans 8",
- "fill-color-rgba", col,
- NULL);
+ /* N, S, E and W labels. */
+ col = sat_cfg_get_int (SAT_CFG_INT_POLAR_TICK_COL);
+ azel_to_xy (polv, 0.0, 0.0, &x, &y);
+ correct_pole_coor (polv, POLAR_PLOT_POLE_N, &x, &y, &anch);
+ polv->N = goo_canvas_text_model_new (root, _("N"),
+ x,
+ y,
+ -1,
+ anch,
+ "font", "Sans 8",
+ "fill-color-rgba", col,
+ NULL);
- azel_to_xy (polv, 180.0, 0.0, &x, &y);
- correct_pole_coor (polv, POLAR_PLOT_POLE_S, &x, &y, &anch);
- polv->S = goo_canvas_text_model_new (root, _("S"),
- x,
- y,
- -1,
- anch,
- "font", "Sans 8",
- "fill-color-rgba", col,
- NULL);
+ azel_to_xy (polv, 180.0, 0.0, &x, &y);
+ correct_pole_coor (polv, POLAR_PLOT_POLE_S, &x, &y, &anch);
+ polv->S = goo_canvas_text_model_new (root, _("S"),
+ x,
+ y,
+ -1,
+ anch,
+ "font", "Sans 8",
+ "fill-color-rgba", col,
+ NULL);
- azel_to_xy (polv, 90.0, 0.0, &x, &y);
- correct_pole_coor (polv, POLAR_PLOT_POLE_E, &x, &y, &anch);
- polv->E = goo_canvas_text_model_new (root, _("E"),
- x,
- y,
- -1,
- anch,
- "font", "Sans 8",
- "fill-color-rgba", col,
- NULL);
+ azel_to_xy (polv, 90.0, 0.0, &x, &y);
+ correct_pole_coor (polv, POLAR_PLOT_POLE_E, &x, &y, &anch);
+ polv->E = goo_canvas_text_model_new (root, _("E"),
+ x,
+ y,
+ -1,
+ anch,
+ "font", "Sans 8",
+ "fill-color-rgba", col,
+ NULL);
- azel_to_xy (polv, 270.0, 0.0, &x, &y);
- correct_pole_coor (polv, POLAR_PLOT_POLE_W, &x, &y, &anch);
- polv->W = goo_canvas_text_model_new (root, _("W"),
- x,
- y,
- -1,
- anch,
- "font", "Sans 8",
- "fill-color-rgba", col,
- NULL);
+ azel_to_xy (polv, 270.0, 0.0, &x, &y);
+ correct_pole_coor (polv, POLAR_PLOT_POLE_W, &x, &y, &anch);
+ polv->W = goo_canvas_text_model_new (root, _("W"),
+ x,
+ y,
+ -1,
+ anch,
+ "font", "Sans 8",
+ "fill-color-rgba", col,
+ NULL);
- /* cursor text */
- col = sat_cfg_get_int (SAT_CFG_INT_POLAR_INFO_COL);
- polv->curs = goo_canvas_text_model_new (root, "",
- polv->cx - polv->r - 2*POLV_LINE_EXTRA,
- polv->cy + polv->r + POLV_LINE_EXTRA,
- -1,
- GTK_ANCHOR_W,
- "font", "Sans 8",
- "fill-color-rgba", col,
- NULL);
+ /* cursor text */
+ col = sat_cfg_get_int (SAT_CFG_INT_POLAR_INFO_COL);
+ polv->curs = goo_canvas_text_model_new (root, "",
+ polv->cx - polv->r - 2*POLV_LINE_EXTRA,
+ polv->cy + polv->r + POLV_LINE_EXTRA,
+ -1,
+ GTK_ANCHOR_W,
+ "font", "Sans 8",
+ "fill-color-rgba", col,
+ NULL);
- /* location info */
- polv->locnam = goo_canvas_text_model_new (root, polv->qth->name,
- polv->cx - polv->r - 2*POLV_LINE_EXTRA,
- polv->cy - polv->r - POLV_LINE_EXTRA,
- -1,
- GTK_ANCHOR_SW,
- "font", "Sans 8",
- "fill-color-rgba", col,
- NULL);
+ /* location info */
+ polv->locnam = goo_canvas_text_model_new (root, polv->qth->name,
+ polv->cx - polv->r - 2*POLV_LINE_EXTRA,
+ polv->cy - polv->r - POLV_LINE_EXTRA,
+ -1,
+ GTK_ANCHOR_SW,
+ "font", "Sans 8",
+ "fill-color-rgba", col,
+ NULL);
- return root;
+ return root;
}
@@ -686,73 +686,73 @@
* the orientation of the polar plot.
*/
static void
-correct_pole_coor (GtkPolarPlot *polv,
- polar_plot_pole_t pole,
- gfloat *x, gfloat *y,
- GtkAnchorType *anch)
+ correct_pole_coor (GtkPolarPlot *polv,
+ polar_plot_pole_t pole,
+ gfloat *x, gfloat *y,
+ GtkAnchorType *anch)
{
- switch (pole) {
+ switch (pole) {
- case POLAR_PLOT_POLE_N:
- if ((polv->swap == POLAR_PLOT_SENW) ||
- (polv->swap == POLAR_PLOT_SWNE)) {
- /* North and South are swapped */
- *y = *y + POLV_LINE_EXTRA;
- *anch = GTK_ANCHOR_NORTH;
- }
- else {
- *y = *y - POLV_LINE_EXTRA;
- *anch = GTK_ANCHOR_SOUTH;
- }
+ case POLAR_PLOT_POLE_N:
+ if ((polv->swap == POLAR_PLOT_SENW) ||
+ (polv->swap == POLAR_PLOT_SWNE)) {
+ /* North and South are swapped */
+ *y = *y + POLV_LINE_EXTRA;
+ *anch = GTK_ANCHOR_NORTH;
+ }
+ else {
+ *y = *y - POLV_LINE_EXTRA;
+ *anch = GTK_ANCHOR_SOUTH;
+ }
- break;
+ break;
- case POLAR_PLOT_POLE_E:
- if ((polv->swap == POLAR_PLOT_NWSE) ||
- (polv->swap == POLAR_PLOT_SWNE)) {
- /* East and West are swapped */
- *x = *x - POLV_LINE_EXTRA;
- *anch = GTK_ANCHOR_EAST;
- }
- else {
- *x = *x + POLV_LINE_EXTRA;
- *anch = GTK_ANCHOR_WEST;
- }
- break;
+ case POLAR_PLOT_POLE_E:
+ if ((polv->swap == POLAR_PLOT_NWSE) ||
+ (polv->swap == POLAR_PLOT_SWNE)) {
+ /* East and West are swapped */
+ *x = *x - POLV_LINE_EXTRA;
+ *anch = GTK_ANCHOR_EAST;
+ }
+ else {
+ *x = *x + POLV_LINE_EXTRA;
+ *anch = GTK_ANCHOR_WEST;
+ }
+ break;
- case POLAR_PLOT_POLE_S:
- if ((polv->swap == POLAR_PLOT_SENW) ||
- (polv->swap == POLAR_PLOT_SWNE)) {
- /* North and South are swapped */
- *y = *y - POLV_LINE_EXTRA;
- *anch = GTK_ANCHOR_SOUTH;
- }
- else {
- *y = *y + POLV_LINE_EXTRA;
- *anch = GTK_ANCHOR_NORTH;
- }
- break;
+ case POLAR_PLOT_POLE_S:
+ if ((polv->swap == POLAR_PLOT_SENW) ||
+ (polv->swap == POLAR_PLOT_SWNE)) {
+ /* North and South are swapped */
+ *y = *y - POLV_LINE_EXTRA;
+ *anch = GTK_ANCHOR_SOUTH;
+ }
+ else {
+ *y = *y + POLV_LINE_EXTRA;
+ *anch = GTK_ANCHOR_NORTH;
+ }
+ break;
- case POLAR_PLOT_POLE_W:
- if ((polv->swap == POLAR_PLOT_NWSE) ||
- (polv->swap == POLAR_PLOT_SWNE)) {
- /* East and West are swapped */
- *x = *x + POLV_LINE_EXTRA;
- *anch = GTK_ANCHOR_WEST;
- }
- else {
- *x = *x - POLV_LINE_EXTRA;
- *anch = GTK_ANCHOR_EAST;
- }
- break;
+ case POLAR_PLOT_POLE_W:
+ if ((polv->swap == POLAR_PLOT_NWSE) ||
+ (polv->swap == POLAR_PLOT_SWNE)) {
+ /* East and West are swapped */
+ *x = *x + POLV_LINE_EXTRA;
+ *anch = GTK_ANCHOR_WEST;
+ }
+ else {
+ *x = *x - POLV_LINE_EXTRA;
+ *anch = GTK_ANCHOR_EAST;
+ }
+ break;
- default:
- sat_log_log (SAT_LOG_LEVEL_BUG,
+ default:
+ sat_log_log (SAT_LOG_LEVEL_BUG,
_("%s:%d: Incorrect polar plot orientation."),
__FILE__, __LINE__);
- break;
- }
+ break;
+ }
}
@@ -763,119 +763,119 @@
* dimensions based on the new canvas size.
*/
static void
-size_allocate_cb (GtkWidget *widget, GtkAllocation *allocation, gpointer data)
+ size_allocate_cb (GtkWidget *widget, GtkAllocation *allocation, gpointer data)
{
- GtkPolarPlot *polv;
- GooCanvasPoints *prec;
- gfloat x,y;
- GtkAnchorType anch = GTK_ANCHOR_CENTER;
+ GtkPolarPlot *polv;
+ GooCanvasPoints *prec;
+ gfloat x,y;
+ GtkAnchorType anch = GTK_ANCHOR_CENTER;
- if (GTK_WIDGET_REALIZED (widget)) {
+ if (GTK_WIDGET_REALIZED (widget)) {
- /* get graph dimensions */
- polv = GTK_POLAR_PLOT (data);
+ /* get graph dimensions */
+ polv = GTK_POLAR_PLOT (data);
- polv->size = MIN(allocation->width, allocation->height);
- polv->r = (polv->size / 2) - POLV_DEFAULT_MARGIN;
- polv->cx = allocation->width / 2;
- polv->cy = allocation->height / 2;
+ polv->size = MIN(allocation->width, allocation->height);
+ polv->r = (polv->size / 2) - POLV_DEFAULT_MARGIN;
+ polv->cx = allocation->width / 2;
+ polv->cy = allocation->height / 2;
goo_canvas_set_bounds (GOO_CANVAS (GTK_POLAR_PLOT (polv)->canvas), 0, 0,
- allocation->width, allocation->height);
+ allocation->width, allocation->height);
- /* update coordinate system */
- g_object_set (polv->C00,
- "center-x", (gdouble) polv->cx,
- "center-y", (gdouble) polv->cy,
- "radius-x", (gdouble) polv->r,
- "radius-y", (gdouble) polv->r,
- NULL);
- g_object_set (polv->C30,
- "center-x", (gdouble) polv->cx,
- "center-y", (gdouble) polv->cy,
- "radius-x", (gdouble) 0.6667*polv->r,
- "radius-y", (gdouble) 0.6667*polv->r,
- NULL);
- g_object_set (polv->C60,
- "center-x", (gdouble) polv->cx,
- "center-y", (gdouble) polv->cy,
- ...
[truncated message content] |
|
From: <cs...@us...> - 2009-11-18 22:30:25
|
Revision: 519
http://gpredict.svn.sourceforge.net/gpredict/?rev=519&view=rev
Author: csete
Date: 2009-11-18 22:30:19 +0000 (Wed, 18 Nov 2009)
Log Message:
-----------
Added config keys for new GRID layout.
Modified Paths:
--------------
trunk/src/sat-cfg.c
trunk/src/sat-cfg.h
Modified: trunk/src/sat-cfg.c
===================================================================
--- trunk/src/sat-cfg.c 2009-11-18 17:06:56 UTC (rev 518)
+++ trunk/src/sat-cfg.c 2009-11-18 22:30:19 UTC (rev 519)
@@ -213,6 +213,7 @@
{ "GLOBAL", "DEFAULT_QTH", "sample.qth"},
{ "GLOBAL", "OPEN_MODULES", "Amateur"},
{ "GLOBAL", "HTML_BROWSER", NULL},
+ { "MODULES", "GRID", "1;0;2;0;1;2;0;1;1;2;3;1;2;1;2"},
{ "MODULES", "MAP_FILE", "nasa-bmng-07_1024.jpg"},
{ "MODULES", "MAP_FONT", "Sans 8"},
{ "MODULES", "POLAR_FONT", "Sans 10"},
Modified: trunk/src/sat-cfg.h
===================================================================
--- trunk/src/sat-cfg.h 2009-11-18 17:06:56 UTC (rev 518)
+++ trunk/src/sat-cfg.h 2009-11-18 22:30:19 UTC (rev 519)
@@ -137,6 +137,7 @@
SAT_CFG_STR_DEF_QTH, /*!< Default QTH file. */
SAT_CFG_STR_OPEN_MODULES, /*!< Open modules. */
SAT_CFG_STR_WEB_BROWSER, /*!< Web browser string. */
+ SAT_CFG_STR_MODULE_GRID, /*!< The grid layout of the module */
SAT_CFG_STR_MAP_FILE, /*!< Map file (abs or rel). */
SAT_CFG_STR_MAP_FONT, /*!< Map font. */
SAT_CFG_STR_POL_FONT, /*!< Polar view font. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cs...@us...> - 2009-11-21 16:56:54
|
Revision: 524
http://gpredict.svn.sourceforge.net/gpredict/?rev=524&view=rev
Author: csete
Date: 2009-11-21 16:56:40 +0000 (Sat, 21 Nov 2009)
Log Message:
-----------
Added files contaiing utilities for the new layout engine.
Modified Paths:
--------------
trunk/src/Makefile.am
Added Paths:
-----------
trunk/src/sat-pref-layout-utils.c
trunk/src/sat-pref-layout-utils.h
Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am 2009-11-21 16:03:23 UTC (rev 523)
+++ trunk/src/Makefile.am 2009-11-21 16:56:40 UTC (rev 524)
@@ -89,6 +89,7 @@
sat-pref-help.c sat-pref-help.h \
sat-pref-modules.c sat-pref-modules.h \
sat-pref-layout.c sat-pref-layout.h \
+ sat-pref-layout-utils.c sat-pref-layout-utils.h \
sat-pref-refresh.c sat-pref-refresh.h \
sat-pref-map-view.c sat-pref-map-view.h \
sat-pref-list-view.c sat-pref-list-view.h \
Added: trunk/src/sat-pref-layout-utils.c
===================================================================
--- trunk/src/sat-pref-layout-utils.c (rev 0)
+++ trunk/src/sat-pref-layout-utils.c 2009-11-21 16:56:40 UTC (rev 524)
@@ -0,0 +1,111 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*
+ Gpredict: Real-time satellite tracking and orbit prediction program
+
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
+
+ Authors: Alexandru Csete <oz...@gm...>
+
+ Comments, questions and bugreports should be submitted via
+ http://sourceforge.net/projects/gpredict/
+ More details can be found at the project home page:
+
+ http://gpredict.oz9aec.net/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, visit http://www.fsf.org/
+*/
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+#ifdef HAVE_CONFIG_H
+# include <build-config.h>
+#endif
+#include "compat.h"
+#include "sat-log.h"
+#include "gtk-sat-module.h"
+#include "sat-pref-layout-utils.h"
+
+
+/** \brief Check the correctness of a layout string.
+ * \param layout The layout string as stored in the config files
+ * "type1;left1;right1;top1;bottom1;type2; ... "
+ * \return LAYOUT_GOOD if the layout is valid, LAYOUT_BAD if the layout is invalid.
+ *
+ * A layout is invalid if it refers to a non-existent view type or if there is something wrong
+ * with the coordinates (e.g. left > right).
+ */
+gboolean sat_pref_layout_check (const gchar *layout)
+{
+ gchar **buffv;
+ guint length, nviews;
+ gint *grid;
+ guint i;
+ gboolean error = FALSE;
+
+
+ /* split layout string into an array of strings */
+ buffv = g_strsplit (layout, ";", 0);
+ length = g_strv_length (buffv);
+
+ /* check correct number of entries */
+ if ((length == 0) || (length % 5 != 0)) {
+ error |= TRUE;
+ }
+
+ nviews = length / 5;
+ grid = g_try_new0 (gint, length);
+
+ /* convert string to array of integers */
+ for (i = 0; i < length; i++) {
+ grid[i] = (gint) g_ascii_strtoll (buffv[i], NULL, 0);
+ }
+
+ /* check each view record */
+ for (i = 0; i < nviews; i++) {
+
+ if ((grid[5*i] >= GTK_SAT_MOD_VIEW_NUM) || /* view type within range */
+ (grid[5*i+1] >= grid[5*i+2]) || /* left < right */
+ (grid[5*i+3] >= grid[5*i+4])) { /* top < bottom */
+
+ error |= TRUE;
+ }
+
+ }
+
+ g_free (grid);
+ g_strfreev (buffv);
+
+ return (error ? LAYOUT_BAD : LAYOUT_GOOD);
+}
+
+
+/** \brief Generate a preview of the specified layout.
+ * \param layout The layout string as stored in the config files
+ * "type1;left1;right1;top1;bottom1;type2; ... "
+ * \return The preview of the layout or a label if invalid
+ */
+GtkWidget *sat_pref_layout_preview (const gchar *layout)
+{
+ GtkWidget *preview;
+
+ if (sat_pref_layout_check (layout) == LAYOUT_BAD) {
+ preview = gtk_label_new (NULL);
+ gtk_label_set_markup (GTK_LABEL (preview), _("<b>Invalid</b>"));
+
+ return preview;
+ }
+
+ preview = gtk_table_new (2, 2, TRUE);
+
+ return preview;
+}
Added: trunk/src/sat-pref-layout-utils.h
===================================================================
--- trunk/src/sat-pref-layout-utils.h (rev 0)
+++ trunk/src/sat-pref-layout-utils.h 2009-11-21 16:56:40 UTC (rev 524)
@@ -0,0 +1,41 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*
+ Gpredict: Real-time satellite tracking and orbit prediction program
+
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
+
+ Authors: Alexandru Csete <oz...@gm...>
+
+ Comments, questions and bugreports should be submitted via
+ http://sourceforge.net/projects/gpredict/
+ More details can be found at the project home page:
+
+ http://gpredict.oz9aec.net/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, visit http://www.fsf.org/
+*/
+#ifndef SAT_PREF_LAYOUT_UTILS_H
+#define SAT_PREF_LAYOUT_UTILS_H 1
+
+
+typedef enum {
+ LAYOUT_BAD = FALSE,
+ LAYOUT_GOOD = TRUE
+} layout_e;
+
+gboolean sat_pref_layout_check (const gchar *layout);
+GtkWidget *sat_pref_layout_preview (const gchar *layout);
+
+
+#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cs...@us...> - 2009-11-22 22:31:35
|
Revision: 525
http://gpredict.svn.sourceforge.net/gpredict/?rev=525&view=rev
Author: csete
Date: 2009-11-22 22:31:10 +0000 (Sun, 22 Nov 2009)
Log Message:
-----------
first working version of the new layout configurator.
Modified Paths:
--------------
trunk/src/sat-cfg.c
trunk/src/sat-pref-layout.c
Modified: trunk/src/sat-cfg.c
===================================================================
--- trunk/src/sat-cfg.c 2009-11-21 16:56:40 UTC (rev 524)
+++ trunk/src/sat-cfg.c 2009-11-22 22:31:10 UTC (rev 525)
@@ -305,8 +305,7 @@
* This function saves the configuration data currently stored in
* memory to the gpredict.cfg file.
*/
-guint
- sat_cfg_save ()
+guint sat_cfg_save ()
{
gsize length;
gsize written;
@@ -396,8 +395,7 @@
* is called again. This function should only be called when the
* program exits.
*/
-void
- sat_cfg_close ()
+void sat_cfg_close ()
{
if (config != NULL) {
g_key_file_free (config);
@@ -448,8 +446,7 @@
}
/** \brief Get default value of boolean parameter */
-gboolean
- sat_cfg_get_bool_def (sat_cfg_bool_e param)
+gboolean sat_cfg_get_bool_def (sat_cfg_bool_e param)
{
gboolean value = FALSE;
@@ -472,8 +469,7 @@
* This function stores a boolean configuration value in the configuration
* table.
*/
-void
- sat_cfg_set_bool (sat_cfg_bool_e param, gboolean value)
+void sat_cfg_set_bool (sat_cfg_bool_e param, gboolean value)
{
if (param < SAT_CFG_BOOL_NUM) {
@@ -529,8 +525,7 @@
*
* Return a newly allocated gchar * which must be freed when no longer needed.
*/
-gchar *
- sat_cfg_get_str (sat_cfg_str_e param)
+gchar *sat_cfg_get_str (sat_cfg_str_e param)
{
gchar *value;
GError *error = NULL;
@@ -575,8 +570,7 @@
*
* Returns a newly allocated gchar * which must be freed when no longer needed.
*/
-gchar *
- sat_cfg_get_str_def (sat_cfg_str_e param)
+gchar *sat_cfg_get_str_def (sat_cfg_str_e param)
{
gchar *value;
@@ -596,8 +590,7 @@
/** \brief Store a str configuration value.
*/
-void
- sat_cfg_set_str (sat_cfg_str_e param, const gchar *value)
+void sat_cfg_set_str (sat_cfg_str_e param, const gchar *value)
{
if (param < SAT_CFG_STR_NUM) {
@@ -632,8 +625,7 @@
}
-void
- sat_cfg_reset_str (sat_cfg_str_e param)
+void sat_cfg_reset_str (sat_cfg_str_e param)
{
if (param < SAT_CFG_STR_NUM) {
@@ -658,8 +650,7 @@
}
}
-gint
- sat_cfg_get_int (sat_cfg_int_e param)
+gint sat_cfg_get_int (sat_cfg_int_e param)
{
gint value = 0;
GError *error = NULL;
@@ -699,8 +690,7 @@
}
-gint
- sat_cfg_get_int_def (sat_cfg_int_e param)
+gint sat_cfg_get_int_def (sat_cfg_int_e param)
{
gint value = 0;
@@ -717,8 +707,7 @@
}
-void
- sat_cfg_set_int (sat_cfg_int_e param, gint value)
+void sat_cfg_set_int (sat_cfg_int_e param, gint value)
{
if (param < SAT_CFG_INT_NUM) {
@@ -743,8 +732,7 @@
}
-void
- sat_cfg_reset_int (sat_cfg_int_e param)
+void sat_cfg_reset_int (sat_cfg_int_e param)
{
if (param < SAT_CFG_INT_NUM) {
Modified: trunk/src/sat-pref-layout.c
===================================================================
--- trunk/src/sat-pref-layout.c 2009-11-21 16:56:40 UTC (rev 524)
+++ trunk/src/sat-pref-layout.c 2009-11-22 22:31:10 UTC (rev 525)
@@ -40,32 +40,28 @@
-static gtk_sat_mod_layout_t layout = 0;
static gboolean dirty = FALSE;
static gboolean reset = FALSE;
-
-/* combo boxes for view seelctors */
-static GtkWidget *combo1,*combo2,*combo3;
-
-/* radio buttons for layout selector */
-static GtkWidget *but1,*but2,*but3,*but4;
-
/* check boxes for window positioning */
static GtkWidget *mwin,*mod,*state;
+/* Text entry for layout string */
+static GtkWidget *gridstr;
+/* private functions */
static void create_layout_selector (GKeyFile *cfg, GtkTable *table);
static void layout_selected_cb (GtkToggleButton *but, gpointer data);
-static void create_view_selectors (GKeyFile *cfg, GtkTable *table);
static void create_window_placement (GtkBox *vbox);
static void create_reset_button (GKeyFile *cfg, GtkBox *vbox);
static GtkWidget *create_combo (void);
static void combo_changed_cb (GtkComboBox *widget, gpointer data);
static void reset_cb (GtkWidget *button, gpointer cfg);
static void window_pos_toggle_cb (GtkWidget *toggle, gpointer data);
+static void layout_code_changed (GtkWidget *widget, gpointer data);
+
/** \brief Create and initialise widgets for the layout view preferences tab.
*
* The widgets must be preloaded with values from config. If a config value
@@ -90,18 +86,10 @@
/* separator */
gtk_table_attach (GTK_TABLE (table),
gtk_hseparator_new (),
- 0, 5, 2, 3,
+ 0, 5, 3, 4,
GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0);
- /* view selectors */
- create_view_selectors (cfg, GTK_TABLE (table));
- /* separator */
- gtk_table_attach (GTK_TABLE (table),
- gtk_hseparator_new (),
- 0, 5, 7, 8,
- GTK_FILL | GTK_EXPAND, GTK_SHRINK, 0, 0);
-
/* create vertical box */
vbox = gtk_vbox_new (FALSE, 5);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 20);
@@ -125,48 +113,33 @@
/** \brief User pressed cancel. Any changes to config must be cancelled.
*/
-void
-sat_pref_layout_cancel (GKeyFile *cfg)
+void sat_pref_layout_cancel (GKeyFile *cfg)
{
- layout = sat_cfg_get_int (SAT_CFG_INT_MODULE_LAYOUT);
+ gchar *str;
+
+ str = sat_cfg_get_str (SAT_CFG_STR_MODULE_GRID);
+ gtk_entry_set_text (GTK_ENTRY (gridstr), str);
+ g_free (str);
+
dirty = FALSE;
}
/** \brief User pressed OK. Any changes should be stored in config.
*/
-void
-sat_pref_layout_ok (GKeyFile *cfg)
+void sat_pref_layout_ok (GKeyFile *cfg)
{
if (dirty) {
/* we have new settings */
if (cfg != NULL) {
- g_key_file_set_integer (cfg,
- MOD_CFG_GLOBAL_SECTION,
- MOD_CFG_LAYOUT,
- layout);
- g_key_file_set_integer (cfg,
- MOD_CFG_GLOBAL_SECTION,
- MOD_CFG_VIEW_1,
- gtk_combo_box_get_active (GTK_COMBO_BOX (combo1)));
- g_key_file_set_integer (cfg,
- MOD_CFG_GLOBAL_SECTION,
- MOD_CFG_VIEW_2,
- gtk_combo_box_get_active (GTK_COMBO_BOX (combo2)));
- g_key_file_set_integer (cfg,
- MOD_CFG_GLOBAL_SECTION,
- MOD_CFG_VIEW_3,
- gtk_combo_box_get_active (GTK_COMBO_BOX (combo3)));
-
+ g_key_file_set_string (cfg,
+ MOD_CFG_GLOBAL_SECTION,
+ MOD_CFG_GRID,
+ gtk_entry_get_text (GTK_ENTRY (gridstr)));
}
else {
- sat_cfg_set_int (SAT_CFG_INT_MODULE_LAYOUT, layout);
- sat_cfg_set_int (SAT_CFG_INT_MODULE_VIEW_1,
- gtk_combo_box_get_active (GTK_COMBO_BOX (combo1)));
- sat_cfg_set_int (SAT_CFG_INT_MODULE_VIEW_2,
- gtk_combo_box_get_active (GTK_COMBO_BOX (combo2)));
- sat_cfg_set_int (SAT_CFG_INT_MODULE_VIEW_3,
- gtk_combo_box_get_active (GTK_COMBO_BOX (combo3)));
+ sat_cfg_set_str (SAT_CFG_STR_MODULE_GRID,
+ gtk_entry_get_text (GTK_ENTRY (gridstr)));
sat_cfg_set_bool (SAT_CFG_BOOL_MAIN_WIN_POS,
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (mwin)));
sat_cfg_set_bool (SAT_CFG_BOOL_MOD_WIN_POS,
@@ -180,13 +153,8 @@
/* we have to reset the values to global or default settings */
if (cfg == NULL) {
- /* views */
- sat_cfg_reset_int (SAT_CFG_INT_MODULE_VIEW_1);
- sat_cfg_reset_int (SAT_CFG_INT_MODULE_VIEW_2);
- sat_cfg_reset_int (SAT_CFG_INT_MODULE_VIEW_3);
-
/* layout */
- sat_cfg_reset_int (SAT_CFG_INT_MODULE_LAYOUT);
+ sat_cfg_reset_str (SAT_CFG_STR_MODULE_GRID);
/* window placement */
sat_cfg_reset_bool (SAT_CFG_BOOL_MAIN_WIN_POS);
@@ -194,26 +162,10 @@
sat_cfg_reset_bool (SAT_CFG_BOOL_MOD_STATE);
}
else {
-
- /* layout views */
- g_key_file_remove_key ((GKeyFile *)(cfg),
- MOD_CFG_GLOBAL_SECTION,
- MOD_CFG_VIEW_1,
- NULL);
- g_key_file_remove_key ((GKeyFile *)(cfg),
- MOD_CFG_GLOBAL_SECTION,
- MOD_CFG_VIEW_2,
- NULL);
- g_key_file_remove_key ((GKeyFile *)(cfg),
- MOD_CFG_GLOBAL_SECTION,
- MOD_CFG_VIEW_3,
- NULL);
-
- /* layout */
- g_key_file_remove_key ((GKeyFile *)(cfg),
- MOD_CFG_GLOBAL_SECTION,
- MOD_CFG_LAYOUT,
- NULL);
+ g_key_file_remove_key ((GKeyFile *)(cfg),
+ MOD_CFG_GLOBAL_SECTION,
+ MOD_CFG_GRID,
+ NULL);
}
}
@@ -223,10 +175,10 @@
/** \brief Create layout selector. */
-static void
-create_layout_selector (GKeyFile *cfg, GtkTable *table)
+static void create_layout_selector (GKeyFile *cfg, GtkTable *table)
{
GtkWidget *label;
+ gchar *buffer;
GtkWidget *image;
gchar *fname;
@@ -234,96 +186,42 @@
label = gtk_label_new (NULL);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_label_set_markup (GTK_LABEL (label),
- _("<b>Default Layout:</b>"));
+ _("<b>Select Layout:</b>"));
gtk_table_attach (GTK_TABLE (table), label, 0, 2, 0, 1,
GTK_FILL, GTK_SHRINK, 0, 0);
- /* layout 1 */
- but1 = gtk_radio_button_new (NULL);
- gtk_table_attach (table, but1, 0, 1, 1, 2,
- GTK_SHRINK, GTK_SHRINK, 0, 0);
- fname = icon_file_name ("gpredict-layout-1.png");
- image = gtk_image_new_from_file (fname);
- g_free (fname);
- gtk_container_add (GTK_CONTAINER (but1), image);
+ /* layout string */
+ label = gtk_label_new (_("Layout code:"));
+ gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
+ GTK_SHRINK | GTK_FILL, GTK_EXPAND | GTK_FILL, 5, 0);
- /* layout 2 */
- but2 = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (but1));
- gtk_table_attach (table, but2, 1, 2, 1, 2,
- GTK_SHRINK, GTK_SHRINK, 0, 0);
- fname = icon_file_name ("gpredict-layout-2.png");
- image = gtk_image_new_from_file (fname);
- g_free (fname);
- gtk_container_add (GTK_CONTAINER (but2), image);
+ if (cfg != NULL) {
+ buffer = mod_cfg_get_str (cfg,
+ MOD_CFG_GLOBAL_SECTION,
+ MOD_CFG_GRID,
+ SAT_CFG_STR_MODULE_GRID);
+ }
+ else {
+ buffer = sat_cfg_get_str (SAT_CFG_STR_MODULE_GRID);
+ }
- /* layout 3 */
- but3 = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (but1));
- gtk_table_attach (table, but3, 2, 3, 1, 2,
- GTK_SHRINK, GTK_SHRINK, 0, 0);
- fname = icon_file_name ("gpredict-layout-3.png");
- image = gtk_image_new_from_file (fname);
- g_free (fname);
- gtk_container_add (GTK_CONTAINER (but3), image);
+ gridstr = gtk_entry_new ();
+ gtk_entry_set_text (GTK_ENTRY (gridstr), buffer);
+ g_free (buffer);
- /* layout 4 */
- but4 = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (but1));
- gtk_table_attach (table, but4, 3, 4, 1, 2,
- GTK_SHRINK, GTK_SHRINK, 0, 0);
- fname = icon_file_name ("gpredict-layout-4.png");
- image = gtk_image_new_from_file (fname);
- g_free (fname);
- gtk_container_add (GTK_CONTAINER (but4), image);
+ gtk_widget_set_tooltip_text (gridstr,
+ _("This entry holds the layout code for the module.\n"\
+ "Consult the user manual for how to create custom layouts "\
+ "using layout codes."));
- /* select current layout */
- if (cfg != NULL) {
- layout = mod_cfg_get_int (cfg,
- MOD_CFG_GLOBAL_SECTION,
- MOD_CFG_LAYOUT,
- SAT_CFG_INT_MODULE_LAYOUT);
- }
- else {
- layout = sat_cfg_get_int (SAT_CFG_INT_MODULE_LAYOUT);
- }
+ /* connect changed signal handler */
+ g_signal_connect (gridstr, "changed", G_CALLBACK (layout_code_changed), NULL);
- switch (layout) {
+ gtk_table_attach_defaults (GTK_TABLE (table), gridstr, 1, 2, 2, 3);
- case GTK_SAT_MOD_LAYOUT_1:
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (but1), TRUE);
- break;
- case GTK_SAT_MOD_LAYOUT_2:
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (but2), TRUE);
- break;
-
- case GTK_SAT_MOD_LAYOUT_3:
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (but3), TRUE);
- break;
-
- case GTK_SAT_MOD_LAYOUT_4:
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (but4), TRUE);
- break;
-
- default:
- sat_log_log (SAT_LOG_LEVEL_BUG,
- _("%s: Invalid module layout (%d)"),
- __FUNCTION__, layout);
- break;
- }
-
- /* connect radio button signals */
- g_signal_connect (but1, "toggled",
- G_CALLBACK (layout_selected_cb),
- GINT_TO_POINTER (GTK_SAT_MOD_LAYOUT_1));
- g_signal_connect (but2, "toggled",
- G_CALLBACK (layout_selected_cb),
- GINT_TO_POINTER (GTK_SAT_MOD_LAYOUT_2));
- g_signal_connect (but3, "toggled",
- G_CALLBACK (layout_selected_cb),
- GINT_TO_POINTER (GTK_SAT_MOD_LAYOUT_3));
- g_signal_connect (but4, "toggled",
- G_CALLBACK (layout_selected_cb),
- GINT_TO_POINTER (GTK_SAT_MOD_LAYOUT_4));
}
/** \brief Callback to manage radio button clicks.
@@ -333,174 +231,19 @@
* newly selected radio button and the de-selected radio button. It must
* therefore check whether the button is currently active or not
*/
-static void
-layout_selected_cb (GtkToggleButton *but, gpointer data)
+static void layout_selected_cb (GtkToggleButton *but, gpointer data)
{
-
- /* update layout if this button is selected */
- if (gtk_toggle_button_get_active (but)) {
- layout = GPOINTER_TO_INT (data);
- dirty = TRUE;
- /* enable/disable combos */
- switch (layout) {
-
- case GTK_SAT_MOD_LAYOUT_1:
- gtk_widget_set_sensitive (combo2, FALSE);
- gtk_widget_set_sensitive (combo3, FALSE);
- break;
-
- case GTK_SAT_MOD_LAYOUT_2:
- gtk_widget_set_sensitive (combo2, TRUE);
- gtk_widget_set_sensitive (combo3, FALSE);
- break;
-
- default:
- gtk_widget_set_sensitive (combo2, TRUE);
- gtk_widget_set_sensitive (combo3, TRUE);
- break;
- }
-
- }
}
-/** \brief Create view selectors.
- * \param cfg Config data or NULL in global mode.
- * \param table The container.
- *
- * This function creates and sets up the view selector combos.
- */
-static void create_view_selectors (GKeyFile *cfg, GtkTable *table)
-{
- GtkWidget *label;
- gint idx;
- /* create header */
- label = gtk_label_new (NULL);
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_label_set_markup (GTK_LABEL (label),
- _("<b>Views:</b>"));
- gtk_table_attach (table, label, 0, 2, 3, 4,
- GTK_FILL, GTK_SHRINK, 0, 0);
-
- /* labels */
- label = gtk_label_new (_("View 1:"));
- gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
- gtk_table_attach (table, label, 0, 1, 4, 5,
- GTK_FILL, GTK_SHRINK, 0, 0);
-
- label = gtk_label_new (_("View 2:"));
- gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
- gtk_table_attach (table, label, 0, 1, 5, 6,
- GTK_FILL, GTK_SHRINK, 0, 0);
-
- label = gtk_label_new (_("View 3:"));
- gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
- gtk_table_attach (table, label, 0, 1, 6, 7,
- GTK_FILL, GTK_SHRINK, 0, 0);
-
- /* combo boxes */
- combo1 = create_combo ();
- if (cfg != NULL) {
- idx = mod_cfg_get_int (cfg,
- MOD_CFG_GLOBAL_SECTION,
- MOD_CFG_VIEW_1,
- SAT_CFG_INT_MODULE_VIEW_1);
- }
- else {
- idx = sat_cfg_get_int (SAT_CFG_INT_MODULE_VIEW_1);
- }
- gtk_combo_box_set_active (GTK_COMBO_BOX (combo1), idx);
- gtk_table_attach (table, combo1, 1, 2, 4, 5,
- GTK_FILL, GTK_SHRINK, 0, 0);
- g_signal_connect (combo1, "changed", G_CALLBACK (combo_changed_cb), NULL);
-
- combo2 = create_combo ();
- if (cfg != NULL) {
- idx = mod_cfg_get_int (cfg,
- MOD_CFG_GLOBAL_SECTION,
- MOD_CFG_VIEW_2,
- SAT_CFG_INT_MODULE_VIEW_2);
- }
- else {
- idx = sat_cfg_get_int (SAT_CFG_INT_MODULE_VIEW_2);
- }
- gtk_combo_box_set_active (GTK_COMBO_BOX (combo2), idx);
- gtk_table_attach (table, combo2, 1, 2, 5, 6,
- GTK_FILL, GTK_SHRINK, 0, 0);
- g_signal_connect (combo2, "changed", G_CALLBACK (combo_changed_cb), NULL);
-
- combo3 = create_combo ();
- if (cfg != NULL) {
- idx = mod_cfg_get_int (cfg,
- MOD_CFG_GLOBAL_SECTION,
- MOD_CFG_VIEW_3,
- SAT_CFG_INT_MODULE_VIEW_3);
- }
- else {
- idx = sat_cfg_get_int (SAT_CFG_INT_MODULE_VIEW_3);
- }
- gtk_combo_box_set_active (GTK_COMBO_BOX (combo3), idx);
- gtk_table_attach (table, combo3, 1, 2, 6, 7,
- GTK_FILL, GTK_SHRINK, 0, 0);
- g_signal_connect (combo3, "changed", G_CALLBACK (combo_changed_cb), NULL);
-
- /* enable/disable combos */
- switch (layout) {
-
- case GTK_SAT_MOD_LAYOUT_1:
- gtk_widget_set_sensitive (combo2, FALSE);
- gtk_widget_set_sensitive (combo3, FALSE);
- break;
-
- case GTK_SAT_MOD_LAYOUT_2:
- gtk_widget_set_sensitive (combo2, TRUE);
- gtk_widget_set_sensitive (combo3, FALSE);
- break;
-
- default:
- gtk_widget_set_sensitive (combo2, TRUE);
- gtk_widget_set_sensitive (combo3, TRUE);
- break;
- }
-}
-
-
-/** \brief Convenience function for creatring combo boxes
- *
- * note: texts must correspond to the order of gtk_sat_mod_view_t
- */
-static GtkWidget *
-create_combo (void)
-{
- GtkWidget *combo;
-
- combo = gtk_combo_box_new_text ();
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("List View"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Map View"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Polar View"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Single Sat"));
-
-
- return combo;
-}
-
-static void
-combo_changed_cb (GtkComboBox *widget, gpointer data)
-{
- dirty = TRUE;
-}
-
-
-
/** \brief Create window placement widgets.
* \param vbox The GtkVBox into which the widgets should be packed.
*
*/
-static void
-create_window_placement (GtkBox *vbox)
+static void create_window_placement (GtkBox *vbox)
{
GtkWidget *label;
GtkTooltips *tips;
@@ -565,8 +308,7 @@
*
* This function creates and sets up the RESET button.
*/
-static void
-create_reset_button (GKeyFile *cfg, GtkBox *vbox)
+static void create_reset_button (GKeyFile *cfg, GtkBox *vbox)
{
GtkWidget *button;
GtkWidget *butbox;
@@ -607,66 +349,26 @@
* in "local" mode (when cfg != NULL) the function will reset the module settings to
* the global settings. This is done by removing the corresponding key from the GKeyFile.
*/
-static void
-reset_cb (GtkWidget *button, gpointer cfg)
+static void reset_cb (GtkWidget *button, gpointer cfg)
{
gint idx;
+ gchar *buffer;
/* views */
if (cfg == NULL) {
/* global mode, get defaults */
- idx = sat_cfg_get_int_def (SAT_CFG_INT_MODULE_VIEW_1);
- gtk_combo_box_set_active (GTK_COMBO_BOX (combo1), idx);
- idx = sat_cfg_get_int_def (SAT_CFG_INT_MODULE_VIEW_2);
- gtk_combo_box_set_active (GTK_COMBO_BOX (combo2), idx);
- idx = sat_cfg_get_int_def (SAT_CFG_INT_MODULE_VIEW_3);
- gtk_combo_box_set_active (GTK_COMBO_BOX (combo3), idx);
+ buffer = sat_cfg_get_str_def (SAT_CFG_STR_MODULE_GRID);
+ gtk_entry_set_text (GTK_ENTRY (gridstr), buffer);
+ g_free (buffer);
}
else {
/* local mode, get global value */
- idx = sat_cfg_get_int (SAT_CFG_INT_MODULE_VIEW_1);
- gtk_combo_box_set_active (GTK_COMBO_BOX (combo1), idx);
- idx = sat_cfg_get_int (SAT_CFG_INT_MODULE_VIEW_2);
- gtk_combo_box_set_active (GTK_COMBO_BOX (combo2), idx);
- idx = sat_cfg_get_int (SAT_CFG_INT_MODULE_VIEW_3);
- gtk_combo_box_set_active (GTK_COMBO_BOX (combo3), idx);
+ buffer = sat_cfg_get_str (SAT_CFG_STR_MODULE_GRID);
+ gtk_entry_set_text (GTK_ENTRY (gridstr), buffer);
+ g_free (buffer);
}
- /* read new layout */
- if (cfg == NULL) {
- layout = sat_cfg_get_int_def (SAT_CFG_INT_MODULE_LAYOUT);
- }
- else {
- layout = sat_cfg_get_int (SAT_CFG_INT_MODULE_LAYOUT);
- }
-
- switch (layout) {
-
- case GTK_SAT_MOD_LAYOUT_1:
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (but1), TRUE);
- break;
-
- case GTK_SAT_MOD_LAYOUT_2:
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (but2), TRUE);
- break;
-
- case GTK_SAT_MOD_LAYOUT_3:
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (but3), TRUE);
- break;
-
- case GTK_SAT_MOD_LAYOUT_4:
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (but4), TRUE);
- break;
-
- default:
- sat_log_log (SAT_LOG_LEVEL_BUG,
- _("%s: Invalid module layout (%d)"),
- __FUNCTION__, layout);
- break;
- }
-
-
/* window placement settings */
if (cfg == NULL) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mwin),
@@ -687,9 +389,43 @@
/** \brief Toggle window positioning settings. */
-static void
-window_pos_toggle_cb (GtkWidget *toggle, gpointer data)
+static void window_pos_toggle_cb (GtkWidget *toggle, gpointer data)
{
dirty = TRUE;
}
+/** \brief Manage layout code changes.
+ *
+ * This function is called when the contents of the lyout code changes.
+ * The purpose of this function is to check whether entered character is valid
+ * and to make the configuration "dirty".
+ */
+static void layout_code_changed (GtkWidget *widget, gpointer data)
+{
+ gchar *entry, *end, *j;
+ gint len, pos;
+
+
+ /* step 1: ensure that only valid characters are entered
+ (stolen from xlog, tnx pg4i)
+ */
+ entry = gtk_editable_get_chars (GTK_EDITABLE (widget), 0, -1);
+ if ((len = g_utf8_strlen (entry, -1)) > 0) {
+ end = entry + g_utf8_strlen (entry, -1);
+ for (j = entry; j < end; ++j) {
+ switch (*j) {
+ case '0' ... '9':
+ case ';':
+ dirty = TRUE;
+ break;
+ default:
+ gdk_beep ();
+ pos = gtk_editable_get_position (GTK_EDITABLE (widget));
+ gtk_editable_delete_text (GTK_EDITABLE (widget),
+ pos, pos+1);
+ break;
+ }
+ }
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cs...@us...> - 2009-11-22 22:45:42
|
Revision: 526
http://gpredict.svn.sourceforge.net/gpredict/?rev=526&view=rev
Author: csete
Date: 2009-11-22 22:45:34 +0000 (Sun, 22 Nov 2009)
Log Message:
-----------
Changed default sized to allow scaling down to 100x100 grid cell size.
Modified Paths:
--------------
trunk/src/gtk-polar-view.c
trunk/src/gtk-sat-map.c
Modified: trunk/src/gtk-polar-view.c
===================================================================
--- trunk/src/gtk-polar-view.c 2009-11-22 22:31:10 UTC (rev 525)
+++ trunk/src/gtk-polar-view.c 2009-11-22 22:45:34 UTC (rev 526)
@@ -47,7 +47,7 @@
-#define POLV_DEFAULT_SIZE 300
+#define POLV_DEFAULT_SIZE 100
#define POLV_DEFAULT_MARGIN 25
/* extra size for line outside 0 deg circle (inside margin) */
Modified: trunk/src/gtk-sat-map.c
===================================================================
--- trunk/src/gtk-sat-map.c 2009-11-22 22:31:10 UTC (rev 525)
+++ trunk/src/gtk-sat-map.c 2009-11-22 22:45:34 UTC (rev 526)
@@ -313,8 +313,8 @@
root = goo_canvas_group_model_new (NULL, NULL);
/* map dimensions */
- satmap->width = gdk_pixbuf_get_width (satmap->origmap);
- satmap->height = gdk_pixbuf_get_height (satmap->origmap);
+ satmap->width = 200; // was: gdk_pixbuf_get_width (satmap->origmap);
+ satmap->height = 100; // was: gdk_pixbuf_get_height (satmap->origmap);
satmap->x0 = 0;
satmap->y0 = 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cs...@us...> - 2009-11-30 14:24:29
|
Revision: 532
http://gpredict.svn.sourceforge.net/gpredict/?rev=532&view=rev
Author: csete
Date: 2009-11-30 14:24:21 +0000 (Mon, 30 Nov 2009)
Log Message:
-----------
First buildable revision with new GtkEventList.
Modified Paths:
--------------
trunk/src/gtk-event-list.c
trunk/src/gtk-event-list.h
trunk/src/sat-cfg.c
Modified: trunk/src/gtk-event-list.c
===================================================================
--- trunk/src/gtk-event-list.c 2009-11-30 14:23:51 UTC (rev 531)
+++ trunk/src/gtk-event-list.c 2009-11-30 14:24:21 UTC (rev 532)
@@ -45,8 +45,11 @@
# include <build-config.h>
#endif
+/*** FIXME */
+#include "gtk-sat-list-popup.h"
+
/** \brief Column titles indexed with column symb. refs. */
const gchar *EVENT_LIST_COL_TITLE[EVENT_LIST_COL_NUMBER] = {
N_("Sat"),
@@ -355,7 +358,7 @@
/* first, do some sanity checks */
- if ((evlist == NULL) || !IS_GTK_EVENT_LIST (satlist)) {
+ if ((evlist == NULL) || !IS_GTK_EVENT_LIST (evlist)) {
sat_log_log (SAT_LOG_LEVEL_BUG,
_("%s: Invalid GtkEventList!"),
__FUNCTION__);
@@ -373,7 +376,7 @@
model = gtk_tree_view_get_model (GTK_TREE_VIEW (evlist->treeview));
/* update */
- gtk_tree_model_foreach (model, event_list_update_sats, satlist);
+ gtk_tree_model_foreach (model, event_list_update_sats, evlist);
}
}
@@ -412,9 +415,12 @@
}
else {
- /**** UPDATED UNTIL HERE *****/
+
+ /**** FIXME *****/
+ /* update data */
+
/* store new data */
- gtk_list_store_set (GTK_LIST_STORE (model), iter,
+/* gtk_list_store_set (GTK_LIST_STORE (model), iter,
SAT_LIST_COL_AZ, sat->az,
SAT_LIST_COL_EL, sat->el,
SAT_LIST_COL_RANGE, sat->range,
@@ -428,67 +434,9 @@
SAT_LIST_COL_PHASE, sat->phase,
SAT_LIST_COL_ORBIT, sat->orbit,
-1);
+*/
- if (satlist->flags & SAT_LIST_FLAG_NEXT_EVENT) {
- gdouble number;
- gchar buff[TIME_FORMAT_MAX_LENGTH];
- gchar *tfstr;
- gchar *fmtstr;
- gchar *alstr;
- time_t t;
- guint size;
-
- if (sat->aos > sat->los) {
- /* next event is LOS */
- number = sat->los;
- alstr = g_strdup ("LOS: ");
- }
- else {
- /* next event is AOS */
- number = sat->aos;
- alstr = g_strdup ("AOS: ");
- }
-
- if (number == 0.0) {
- gtk_list_store_set (GTK_LIST_STORE (model), iter,
- SAT_LIST_COL_NEXT_EVENT, "--- N/A ---",
- -1);
- }
- else {
-
- /* convert julian date to struct tm */
- t = (number - 2440587.5)*86400.;
-
- /* format the number */
- tfstr = sat_cfg_get_str (SAT_CFG_STR_TIME_FORMAT);
- fmtstr = g_strconcat (alstr, tfstr, NULL);
- g_free (tfstr);
-
- /* format either local time or UTC depending on check box */
- if (sat_cfg_get_bool (SAT_CFG_BOOL_USE_LOCAL_TIME))
- size = strftime (buff, TIME_FORMAT_MAX_LENGTH,
- fmtstr, localtime (&t));
- else
- size = strftime (buff, TIME_FORMAT_MAX_LENGTH,
- fmtstr, gmtime (&t));
-
- if (size == 0)
- /* size > MAX_LENGTH */
- buff[TIME_FORMAT_MAX_LENGTH-1] = '\0';
-
- gtk_list_store_set (GTK_LIST_STORE (model), iter,
- SAT_LIST_COL_NEXT_EVENT, buff,
- -1);
-
-
- g_free (fmtstr);
- }
-
- g_free (alstr);
-
- }
-
}
g_free (catnum);
@@ -509,78 +457,24 @@
switch (i) {
- /* general float with 2 dec. precision
- no extra format besides a degree char
- */
- case SAT_LIST_COL_AZ:
- case SAT_LIST_COL_EL:
- case SAT_LIST_COL_RA:
- case SAT_LIST_COL_DEC:
- case SAT_LIST_COL_MA:
- case SAT_LIST_COL_PHASE:
+ /* Event type */
+ case EVENT_LIST_COL_EVT:
gtk_tree_view_column_set_cell_data_func (column,
renderer,
- degree_cell_data_function,
+ evtype_cell_data_function,
GUINT_TO_POINTER (i),
NULL);
break;
- /* LAT/LON format */
- case SAT_LIST_COL_LAT:
- case SAT_LIST_COL_LON:
+ /* time countdown */
+ case EVENT_LIST_COL_TIME:
gtk_tree_view_column_set_cell_data_func (column,
renderer,
- latlon_cell_data_function,
+ time_cell_data_function,
GUINT_TO_POINTER (i),
NULL);
break;
- /* distances and velocities */
- case SAT_LIST_COL_RANGE:
- case SAT_LIST_COL_ALT:
- case SAT_LIST_COL_FOOTPRINT:
- gtk_tree_view_column_set_cell_data_func (column,
- renderer,
- distance_cell_data_function,
- GUINT_TO_POINTER (i),
- NULL);
- break;
-
- case SAT_LIST_COL_VEL:
- case SAT_LIST_COL_RANGE_RATE:
- gtk_tree_view_column_set_cell_data_func (column,
- renderer,
- range_rate_cell_data_function,
- GUINT_TO_POINTER (i),
- NULL);
- break;
-
- case SAT_LIST_COL_DOPPLER:
- gtk_tree_view_column_set_cell_data_func (column,
- renderer,
- float_to_int_cell_data_function,
- GUINT_TO_POINTER (i),
- NULL);
- break;
-
- case SAT_LIST_COL_DELAY:
- case SAT_LIST_COL_LOSS:
- gtk_tree_view_column_set_cell_data_func (column,
- renderer,
- two_dec_cell_data_function,
- GUINT_TO_POINTER (i),
- NULL);
- break;
-
- case SAT_LIST_COL_AOS:
- case SAT_LIST_COL_LOS:
- gtk_tree_view_column_set_cell_data_func (column,
- renderer,
- event_cell_data_function,
- GUINT_TO_POINTER (i),
- NULL);
- break;
-
default:
break;
@@ -589,242 +483,64 @@
}
-/* render column containg lat/lon
- by using this instead of the default data function, we can
- control the number of decimals and display the coordinates in a
- fancy way, including degree sign and NWSE suffixes.
-
- Please note that this function only affects how the numbers are
- displayed (rendered), the tree_store will still contain the
- original flaoting point numbers. Very cool!
-*/
-static void
-latlon_cell_data_function (GtkTreeViewColumn *col,
- GtkCellRenderer *renderer,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer column)
+/** \brief Render column containg event type.
+ *
+ * Event type can be AOS or LOS depending on whether the satellite is within
+ * range or not. AOS will rendern an "A", LOS will render an "L".
+ */
+static void evtype_cell_data_function (GtkTreeViewColumn *col,
+ GtkCellRenderer *renderer,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer column)
{
- gdouble number = 0.0;
- gchar *buff;
- guint coli = GPOINTER_TO_UINT (column);
- gchar hmf = ' ';
+ gboolean value;
+ gchar *buff;
+ guint coli = GPOINTER_TO_UINT (column);
- gtk_tree_model_get (model, iter, coli, &number, -1);
- /* check whether configuration requests the use
- of N, S, E and W instead of signs
- */
- if (sat_cfg_get_bool (SAT_CFG_BOOL_USE_NSEW)) {
+ /* get field value from cell */
+ gtk_tree_model_get (model, iter, coli, &value, -1);
- if (coli == SAT_LIST_COL_LAT) {
- if (number < 0.00) {
- number = -number;
- hmf = 'S';
- }
- else {
- hmf = 'N';
- }
- }
- else if (coli == SAT_LIST_COL_LON) {
- if (number < 0.00) {
- number = -number;
- hmf = 'W';
- }
- else {
- hmf = 'E';
- }
- }
- else {
- sat_log_log (SAT_LOG_LEVEL_BUG,
- _("%s:%d: Invalid column: %d"),
- __FILE__, __LINE__,
- coli);
- hmf = '?';
- }
- }
- /* format the number */
- buff = g_strdup_printf ("%.2f\302\260%c", number, hmf);
- g_object_set (renderer,
- "text", buff,
- NULL);
- g_free (buff);
-}
-
-
-/* general floats with 2 digits + degree char */
-static void
-degree_cell_data_function (GtkTreeViewColumn *col,
- GtkCellRenderer *renderer,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer column)
-{
- gdouble number;
- gchar *buff;
- guint coli = GPOINTER_TO_UINT (column);
-
- gtk_tree_model_get (model, iter, coli, &number, -1);
-
- /* format the number */
- buff = g_strdup_printf ("%.2f\302\260", number);
- g_object_set (renderer,
- "text", buff,
- NULL);
- g_free (buff);
-}
-
-
-/* distance and velocity, 0 decimal digits */
-static void
-distance_cell_data_function (GtkTreeViewColumn *col,
- GtkCellRenderer *renderer,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer column)
-{
- gdouble number;
- gchar *buff;
- guint coli = GPOINTER_TO_UINT (column);
-
- gtk_tree_model_get (model, iter, coli, &number, -1);
-
- /* convert distance to miles? */
- if (sat_cfg_get_bool (SAT_CFG_BOOL_USE_IMPERIAL)) {
- number = KM_TO_MI(number);
+ if (value = TRUE) {
+ buff = g_strdup ("L");
}
-
- /* format the number */
- buff = g_strdup_printf ("%.0f", number);
- g_object_set (renderer,
- "text", buff,
- NULL);
- g_free (buff);
-}
-
-/* range rate is special, because we may need to convert to miles
- and want 2-3 decimal digits.
-*/
-static void
-range_rate_cell_data_function (GtkTreeViewColumn *col,
- GtkCellRenderer *renderer,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer column)
-{
- gdouble number;
- gchar *buff;
- guint coli = GPOINTER_TO_UINT (column);
-
- gtk_tree_model_get (model, iter, coli, &number, -1);
-
- /* convert distance to miles? */
- if (sat_cfg_get_bool (SAT_CFG_BOOL_USE_IMPERIAL)) {
- number = KM_TO_MI(number);
+ else {
+ buff = g_strdup ("A");
}
- /* format the number */
- buff = g_strdup_printf ("%.3f", number);
- g_object_set (renderer,
- "text", buff,
- NULL);
+ /* render the cell */
+ g_object_set (renderer, "text", buff, NULL);
g_free (buff);
}
-/* 0 decimal digits */
-static void
-float_to_int_cell_data_function (GtkTreeViewColumn *col,
- GtkCellRenderer *renderer,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer column)
-{
- gdouble number;
- gchar *buff;
- guint coli = GPOINTER_TO_UINT (column);
- gtk_tree_model_get (model, iter, coli, &number, -1);
- /* format the number */
- buff = g_strdup_printf ("%.0f", number);
- g_object_set (renderer,
- "text", buff,
- NULL);
- g_free (buff);
-}
-
-/* 2 decimal digits */
-static void
-two_dec_cell_data_function (GtkTreeViewColumn *col,
- GtkCellRenderer *renderer,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer column)
+/* AOS/LOS; convert julian date to string */
+static void time_cell_data_function (GtkTreeViewColumn *col,
+ GtkCellRenderer *renderer,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer column)
{
gdouble number;
gchar *buff;
guint coli = GPOINTER_TO_UINT (column);
-
- gtk_tree_model_get (model, iter, coli, &number, -1);
-
- /* format the number */
- buff = g_strdup_printf ("%.2f", number);
- g_object_set (renderer,
- "text", buff,
- NULL);
- g_free (buff);
-}
-
-
-/* AOS/LOS; convert julian date to string */
-static void
-event_cell_data_function (GtkTreeViewColumn *col,
- GtkCellRenderer *renderer,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer column)
-{
- gdouble number;
- gchar buff[TIME_FORMAT_MAX_LENGTH];
- gchar *fmtstr;
- guint coli = GPOINTER_TO_UINT (column);
time_t t;
guint size;
+ /* get cell data */
gtk_tree_model_get (model, iter, coli, &number, -1);
-
- if (number == 0.0) {
- g_object_set (renderer,
- "text", "--- N/A ---",
- NULL);
- }
- else {
- /* convert julian date to struct tm */
- t = (number - 2440587.5)*86400.;
+ /* format the time code */
+ buff = g_strdup_printf ("%.6f", number);
- /* format the number */
- fmtstr = sat_cfg_get_str (SAT_CFG_STR_TIME_FORMAT);
+ /* render the cell */
+ g_object_set (renderer, "text", buff, NULL);
+ g_free (buff);
- /* format either local time or UTC depending on check box */
- if (sat_cfg_get_bool (SAT_CFG_BOOL_USE_LOCAL_TIME))
- size = strftime (buff, TIME_FORMAT_MAX_LENGTH, fmtstr, localtime (&t));
- else
- size = strftime (buff, TIME_FORMAT_MAX_LENGTH, fmtstr, gmtime (&t));
-
- if (size == 0)
- /* size > TIME_FORMAT_MAX_LENGTH */
- buff[TIME_FORMAT_MAX_LENGTH-1] = '\0';
-
- g_object_set (renderer,
- "text", buff,
- NULL);
-
- g_free (fmtstr);
- }
-
}
@@ -878,8 +594,7 @@
/** \brief Reload configuration */
-void
-gtk_sat_list_reconf (GtkWidget *widget, GKeyFile *cfgdat)
+void gtk_event_list_reconf (GtkWidget *widget, GKeyFile *cfgdat)
{
sat_log_log (SAT_LOG_LEVEL_WARN, _("%s: FIXME I am not implemented"));
}
@@ -890,17 +605,12 @@
* \param treeview The tree view in the GtkSatList widget
* \param list Pointer to the GtkSatList widget.
*
- * This function is called when the "popup-menu" signal is emitted. This
- * usually happens if the user presses SHJIFT-F10? It is used as a wrapper
- * for the function that actually creates the popup menu.
*/
-static gboolean
-popup_menu_cb (GtkWidget *treeview, gpointer list)
+static gboolean popup_menu_cb (GtkWidget *treeview, gpointer list)
{
/* if there is no selection, select the first row */
-
view_popup_menu (treeview, NULL, list);
return TRUE; /* we handled this */
@@ -913,8 +623,7 @@
* \param list Pointer to the GtkSatList widget.
*
*/
-static gboolean
-button_press_cb (GtkWidget *treeview, GdkEventButton *event, gpointer list)
+static gboolean button_press_cb (GtkWidget *treeview, GdkEventButton *event, gpointer list)
{
/* single click with the right mouse button? */
@@ -955,8 +664,7 @@
}
-static void
-view_popup_menu (GtkWidget *treeview, GdkEventButton *event, gpointer list)
+static void view_popup_menu (GtkWidget *treeview, GdkEventButton *event, gpointer list)
{
GtkTreeSelection *selection;
GtkTreeModel *model;
@@ -972,7 +680,7 @@
gtk_tree_model_get (model, &iter,
- SAT_LIST_COL_CATNUM, catnum,
+ EVENT_LIST_COL_CATNUM, catnum,
-1);
sat = SAT (g_hash_table_lookup (GTK_SAT_LIST (list)->satellites, catnum));
@@ -1000,64 +708,12 @@
}
-/*** FIXME: formalise with other copies, only need az,el and jul_utc */
-static void
-Calculate_RADec (sat_t *sat, qth_t *qth, obs_astro_t *obs_set)
-{
- /* Reference: Methods of Orbit Determination by */
- /* Pedro Ramon Escobal, pp. 401-402 */
- double phi,theta,sin_theta,cos_theta,sin_phi,cos_phi,
- az,el,Lxh,Lyh,Lzh,Sx,Ex,Zx,Sy,Ey,Zy,Sz,Ez,Zz,
- Lx,Ly,Lz,cos_delta,sin_alpha,cos_alpha;
- geodetic_t geodetic;
- geodetic.lon = qth->lon * de2ra;
- geodetic.lat = qth->lat * de2ra;
- geodetic.alt = qth->alt / 1000.0;
- geodetic.theta = 0;
-
-
-
- az = sat->az * de2ra;
- el = sat->el * de2ra;
- phi = geodetic.lat;
- theta = FMod2p(ThetaG_JD(sat->jul_utc) + geodetic.lon);
- sin_theta = sin(theta);
- cos_theta = cos(theta);
- sin_phi = sin(phi);
- cos_phi = cos(phi);
- Lxh = -cos(az) * cos(el);
- Lyh = sin(az) * cos(el);
- Lzh = sin(el);
- Sx = sin_phi * cos_theta;
- Ex = -sin_theta;
- Zx = cos_theta * cos_phi;
- Sy = sin_phi * sin_theta;
- Ey = cos_theta;
- Zy = sin_theta*cos_phi;
- Sz = -cos_phi;
- Ez = 0;
- Zz = sin_phi;
- Lx = Sx*Lxh + Ex * Lyh + Zx*Lzh;
- Ly = Sy*Lxh + Ey * Lyh + Zy*Lzh;
- Lz = Sz*Lxh + Ez * Lyh + Zz*Lzh;
- obs_set->dec = ArcSin(Lz); /* Declination (radians)*/
- cos_delta = sqrt(1 - Sqr(Lz));
- sin_alpha = Ly / cos_delta;
- cos_alpha = Lx / cos_delta;
- obs_set->ra = AcTan(sin_alpha,cos_alpha); /* Right Ascension (radians)*/
- obs_set->ra = FMod2p(obs_set->ra);
-
-}
-
-
-
-
/** \brief Reload reference to satellites (e.g. after TLE update). */
void
-gtk_sat_list_reload_sats (GtkWidget *satlist, GHashTable *sats)
+gtk_event_list_reload_sats (GtkWidget *evlist, GHashTable *sats)
{
- GTK_SAT_LIST (satlist)->satellites = sats;
+ GTK_EVENT_LIST (evlist)->satellites = sats;
}
Modified: trunk/src/gtk-event-list.h
===================================================================
--- trunk/src/gtk-event-list.h 2009-11-30 14:23:51 UTC (rev 531)
+++ trunk/src/gtk-event-list.h 2009-11-30 14:24:21 UTC (rev 532)
@@ -40,7 +40,7 @@
#endif /* __cplusplus */
-#define GTK_TYPE_EVENT_LIST (gtk_EVENT_list_get_type ())
+#define GTK_TYPE_EVENT_LIST (gtk_event_list_get_type ())
#define GTK_EVENT_LIST(obj) GTK_CHECK_CAST (obj,\
gtk_event_list_get_type (),\
GtkEventList)
Modified: trunk/src/sat-cfg.c
===================================================================
--- trunk/src/sat-cfg.c 2009-11-30 14:23:51 UTC (rev 531)
+++ trunk/src/sat-cfg.c 2009-11-30 14:24:21 UTC (rev 532)
@@ -144,10 +144,10 @@
{ "VERSION", "MAJOR", 0},
{ "VERSION", "MINOR", 0},
{ "MODULES", "DATA_TIMEOUT", 300},
- { "MODULES", "LAYOUT", GTK_SAT_MOD_LAYOUT_3},
- { "MODULES", "VIEW_1", GTK_SAT_MOD_VIEW_MAP},
- { "MODULES", "VIEW_2", GTK_SAT_MOD_VIEW_POLAR},
- { "MODULES", "VIEW_3", GTK_SAT_MOD_VIEW_SINGLE},
+ { "MODULES", "LAYOUT", 2}, /* FIXME */
+ { "MODULES", "VIEW_1", GTK_SAT_MOD_VIEW_MAP}, /* FIXME */
+ { "MODULES", "VIEW_2", GTK_SAT_MOD_VIEW_POLAR}, /* FIXME */
+ { "MODULES", "VIEW_3", GTK_SAT_MOD_VIEW_SINGLE}, /* FIXME */
{ "GLOBAL", "WARP", 1},
{ "MODULES", "LIST_REFRESH", 1},
{ "MODULES", "LIST_COLUMNS", LIST_COLUMNS_DEFAULTS},
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cs...@us...> - 2009-12-01 10:33:18
|
Revision: 535
http://gpredict.svn.sourceforge.net/gpredict/?rev=535&view=rev
Author: csete
Date: 2009-12-01 10:33:10 +0000 (Tue, 01 Dec 2009)
Log Message:
-----------
Added configuration keys for GtkEventList.
Modified Paths:
--------------
trunk/src/config-keys.h
trunk/src/sat-cfg.c
trunk/src/sat-cfg.h
Modified: trunk/src/config-keys.h
===================================================================
--- trunk/src/config-keys.h 2009-11-30 16:51:16 UTC (rev 534)
+++ trunk/src/config-keys.h 2009-12-01 10:33:10 UTC (rev 535)
@@ -127,4 +127,9 @@
#define MOD_CFG_SINGLE_SAT_REFRESH "REFRESH"
#define MOD_CFG_SINGLE_SAT_FIELDS "FIELDS"
+/* event list */
+#define MOD_CFG_EVENT_LIST_SECTION "EVENT_LIST"
+#define MOD_CFG_EVENT_LIST_REFRESH "REFRESH"
+
+
#endif
Modified: trunk/src/sat-cfg.c
===================================================================
--- trunk/src/sat-cfg.c 2009-11-30 16:51:16 UTC (rev 534)
+++ trunk/src/sat-cfg.c 2009-12-01 10:33:10 UTC (rev 535)
@@ -173,6 +173,7 @@
{ "MODULES", "POLAR_INFO_COLOUR", 0x00007FFF},
{ "MODULES", "SINGLE_SAT_REFRESH", 1},
{ "MODULES", "SINGLE_SAT_FIELDS", SINGLE_SAT_FIELD_DEF},
+ { "MODULES", "EVENT_LIST_REFRESH", 1},
{ "PREDICT", "MINIMUM_ELEV", 5},
{ "PREDICT", "NUMBER_OF_PASSES", 10},
{ "PREDICT", "LOOK_AHEAD", 3},
Modified: trunk/src/sat-cfg.h
===================================================================
--- trunk/src/sat-cfg.h 2009-11-30 16:51:16 UTC (rev 534)
+++ trunk/src/sat-cfg.h 2009-12-01 10:33:10 UTC (rev 535)
@@ -95,6 +95,7 @@
SAT_CFG_INT_POLAR_INFO_COL, /*!< Info colour. */
SAT_CFG_INT_SINGLE_SAT_REFRESH, /*!< Single-sat refresh rate (cycle). */
SAT_CFG_INT_SINGLE_SAT_FIELDS, /*!< Single-sat fields. */
+ SAT_CFG_INT_EVENT_LIST_REFRESH, /*!< Event list refresh rate (cycle). */
SAT_CFG_INT_PRED_MIN_EL, /*!< Minimum elevation for passes. */
SAT_CFG_INT_PRED_NUM_PASS, /*!< Number of passes to predict. */
SAT_CFG_INT_PRED_LOOK_AHEAD, /*!< Look-ahead time limit in days. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cs...@us...> - 2009-12-27 01:00:59
|
Revision: 561
http://gpredict.svn.sourceforge.net/gpredict/?rev=561&view=rev
Author: csete
Date: 2009-12-27 01:00:53 +0000 (Sun, 27 Dec 2009)
Log Message:
-----------
Fixed bug 2914679: Unable to save Future passes.
Modified Paths:
--------------
trunk/src/pass-to-txt.c
trunk/src/save-pass.c
Modified: trunk/src/pass-to-txt.c
===================================================================
--- trunk/src/pass-to-txt.c 2009-12-27 00:17:34 UTC (rev 560)
+++ trunk/src/pass-to-txt.c 2009-12-27 01:00:53 UTC (rev 561)
@@ -599,6 +599,8 @@
/* size > TIME_FORMAT_MAX_LENGTH */
tbuff[TIME_FORMAT_MAX_LENGTH-1] = '\0';
+ line = g_strdup_printf (" %s", tbuff);
+
/* TCA */
t = (pass->tca - 2440587.5)*86400.;
if (sat_cfg_get_bool (SAT_CFG_BOOL_USE_LOCAL_TIME))
Modified: trunk/src/save-pass.c
===================================================================
--- trunk/src/save-pass.c 2009-12-27 00:17:34 UTC (rev 560)
+++ trunk/src/save-pass.c 2009-12-27 01:00:53 UTC (rev 561)
@@ -506,10 +506,10 @@
g_free (tblheader);
g_free (tblcontents);
-
if (contents == PASSES_CONTENT_FULL) {
fields = sat_cfg_get_int (SAT_CFG_INT_PRED_SINGLE_COL);
n = g_slist_length (passes);
+
for (i = 0; i < n; i++) {
pass = PASS (g_slist_nth_data (passes, i));
@@ -533,7 +533,7 @@
break;
- default:
+ default:
sat_log_log (SAT_LOG_LEVEL_BUG,
_("%s: Invalid file format: %d"),
__FUNCTION__, format);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cs...@us...> - 2009-12-27 01:27:56
|
Revision: 560
http://gpredict.svn.sourceforge.net/gpredict/?rev=560&view=rev
Author: csete
Date: 2009-12-27 00:17:34 +0000 (Sun, 27 Dec 2009)
Log Message:
-----------
Fixed indentation.
Modified Paths:
--------------
trunk/src/sat-pass-dialogs.c
trunk/src/save-pass.c
Modified: trunk/src/sat-pass-dialogs.c
===================================================================
--- trunk/src/sat-pass-dialogs.c 2009-12-27 00:12:09 UTC (rev 559)
+++ trunk/src/sat-pass-dialogs.c 2009-12-27 00:17:34 UTC (rev 560)
@@ -265,8 +265,7 @@
* of fullscreen modules.
*
*/
-void
- show_pass (const gchar *satname, qth_t *qth, pass_t *pass, GtkWidget *toplevel)
+void show_pass (const gchar *satname, qth_t *qth, pass_t *pass, GtkWidget *toplevel)
{
GtkWidget *dialog; /* the dialogue window */
GtkWidget *notebook; /* the notebook widet */
@@ -538,8 +537,7 @@
* Use sat, qth, and passes labels to obtain the relevant data
*
*/
-static void
- single_pass_response (GtkWidget *dialog, gint response, gpointer data)
+static void single_pass_response (GtkWidget *dialog, gint response, gpointer data)
{
switch (response) {
@@ -564,10 +562,9 @@
/** \brief Set cell renderer function. */
-static void
- check_and_set_single_cell_renderer (GtkTreeViewColumn *column,
- GtkCellRenderer *renderer,
- gint i)
+static void check_and_set_single_cell_renderer (GtkTreeViewColumn *column,
+ GtkCellRenderer *renderer,
+ gint i)
{
switch (i) {
@@ -660,12 +657,11 @@
displayed (rendered), the tree_store will still contain the
original flaoting point numbers. Very cool!
*/
-static void
- latlon_cell_data_function (GtkTreeViewColumn *col,
- GtkCellRenderer *renderer,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer column)
+static void latlon_cell_data_function (GtkTreeViewColumn *col,
+ GtkCellRenderer *renderer,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer column)
{
gdouble number = 0.0;
gchar *buff;
@@ -717,12 +713,11 @@
/* general floats with 2 digits + degree char */
-static void
- degree_cell_data_function (GtkTreeViewColumn *col,
- GtkCellRenderer *renderer,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer column)
+static void degree_cell_data_function (GtkTreeViewColumn *col,
+ GtkCellRenderer *renderer,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer column)
{
gdouble number;
gchar *buff;
@@ -741,12 +736,11 @@
/* distance and velocity, 0 decimal digits */
-static void
- distance_cell_data_function (GtkTreeViewColumn *col,
- GtkCellRenderer *renderer,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer column)
+static void distance_cell_data_function (GtkTreeViewColumn *col,
+ GtkCellRenderer *renderer,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer column)
{
gdouble number;
gchar *buff;
@@ -770,12 +764,11 @@
/* range rate is special, because we may need to convert to miles
and want 2-3 decimal digits.
*/
-static void
- range_rate_cell_data_function (GtkTreeViewColumn *col,
- GtkCellRenderer *renderer,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer column)
+static void range_rate_cell_data_function (GtkTreeViewColumn *col,
+ GtkCellRenderer *renderer,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer column)
{
gdouble number;
gchar *buff;
@@ -797,12 +790,11 @@
}
/* 0 decimal digits */
-static void
- float_to_int_cell_data_function (GtkTreeViewColumn *col,
- GtkCellRenderer *renderer,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer column)
+static void float_to_int_cell_data_function (GtkTreeViewColumn *col,
+ GtkCellRenderer *renderer,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer column)
{
gdouble number;
gchar *buff;
@@ -819,12 +811,11 @@
}
/* 2 decimal digits */
-static void
- two_dec_cell_data_function (GtkTreeViewColumn *col,
- GtkCellRenderer *renderer,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer column)
+static void two_dec_cell_data_function (GtkTreeViewColumn *col,
+ GtkCellRenderer *renderer,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer column)
{
gdouble number;
gchar *buff;
@@ -842,12 +833,11 @@
/* AOS/LOS; convert julian date to string */
-static void
- time_cell_data_function (GtkTreeViewColumn *col,
- GtkCellRenderer *renderer,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer column)
+static void time_cell_data_function (GtkTreeViewColumn *col,
+ GtkCellRenderer *renderer,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer column)
{
gdouble number;
gchar buff[TIME_FORMAT_MAX_LENGTH];
@@ -898,15 +888,13 @@
-static gint
- single_pass_dialog_delete (GtkWidget *dialog, GdkEvent *event, gpointer pass)
+static gint single_pass_dialog_delete (GtkWidget *dialog, GdkEvent *event, gpointer pass)
{
/* dialog will be destroyed */
return FALSE;
}
-static void
- single_pass_dialog_destroy (GtkWidget *dialog, gpointer data)
+static void single_pass_dialog_destroy (GtkWidget *dialog, gpointer data)
{
pass_t *pass = PASS(g_object_get_data (G_OBJECT (dialog), "pass"));
@@ -917,9 +905,8 @@
/*** FIXME: formalise with other copies */
-static void
- Calc_RADec (gdouble jul_utc, gdouble saz, gdouble sel,
- qth_t *qth, obs_astro_t *obs_set)
+static void Calc_RADec (gdouble jul_utc, gdouble saz, gdouble sel,
+ qth_t *qth, obs_astro_t *obs_set)
{
double phi,theta,sin_theta,cos_theta,sin_phi,cos_phi,
@@ -978,8 +965,7 @@
* details of a pass.
*
*/
-void
- show_passes (const gchar *satname, qth_t *qth, GSList *passes, GtkWidget *toplevel)
+void show_passes (const gchar *satname, qth_t *qth, GSList *passes, GtkWidget *toplevel)
{
GtkWidget *dialog;
GtkWidget *list;
@@ -1151,8 +1137,7 @@
* Use sat, qth, and passes labels to obtain the relevant data
*
*/
-static void
- multi_pass_response (GtkWidget *dialog, gint response, gpointer data)
+static void multi_pass_response (GtkWidget *dialog, gint response, gpointer data)
{
switch (response) {
@@ -1175,16 +1160,14 @@
-static gint
- multi_pass_dialog_delete (GtkWidget *dialog, GdkEvent *event, gpointer pass)
+static gint multi_pass_dialog_delete (GtkWidget *dialog, GdkEvent *event, gpointer pass)
{
/* dialog will be destroyed */
return FALSE;
}
-static void
- multi_pass_dialog_destroy (GtkWidget *dialog, gpointer data)
+static void multi_pass_dialog_destroy (GtkWidget *dialog, gpointer data)
{
GSList *passes = (GSList *) g_object_get_data (G_OBJECT (dialog), "passes");
@@ -1196,10 +1179,9 @@
/** \brief Set cell renderer function. */
-static void
- check_and_set_multi_cell_renderer (GtkTreeViewColumn *column,
- GtkCellRenderer *renderer,
- gint i)
+static void check_and_set_multi_cell_renderer (GtkTreeViewColumn *column,
+ GtkCellRenderer *renderer,
+ gint i)
{
switch (i) {
@@ -1246,12 +1228,11 @@
/* duration; convert delta t in days to HH:MM:SS */
-static void
- duration_cell_data_function (GtkTreeViewColumn *col,
- GtkCellRenderer *renderer,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer column)
+static void duration_cell_data_function (GtkTreeViewColumn *col,
+ GtkCellRenderer *renderer,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer column)
{
gdouble number;
gchar *buff;
@@ -1323,8 +1304,7 @@
* usually happens if the user presses SHJIFT-F10? It is used as a wrapper
* for the function that actually creates the popup menu.
*/
-static gboolean
- popup_menu_cb (GtkWidget *treeview, gpointer data)
+static gboolean popup_menu_cb (GtkWidget *treeview, gpointer data)
{
/* if there is no selection, select the first row */
@@ -1342,8 +1322,7 @@
* \param list Pointer to the GtkSatList widget.
*
*/
-static gboolean
- button_press_cb (GtkWidget *treeview, GdkEventButton *event, gpointer data)
+static gboolean button_press_cb (GtkWidget *treeview, GdkEventButton *event, gpointer data)
{
/* single click with the right mouse button? */
@@ -1384,8 +1363,7 @@
}
-static void
- view_popup_menu (GtkWidget *treeview, GdkEventButton *event, gpointer data)
+static void view_popup_menu (GtkWidget *treeview, GdkEventButton *event, gpointer data)
{
GtkTreeSelection *selection;
GtkTreeModel *model;
Modified: trunk/src/save-pass.c
===================================================================
--- trunk/src/save-pass.c 2009-12-27 00:12:09 UTC (rev 559)
+++ trunk/src/save-pass.c 2009-12-27 00:17:34 UTC (rev 560)
@@ -84,8 +84,7 @@
*
* \note All the relevant data are attached to the parent dialogue window.
*/
-void
- save_pass (GtkWidget *parent)
+void save_pass (GtkWidget *parent)
{
GtkWidget *dialog;
GtkWidget *table;
@@ -248,8 +247,7 @@
*
* \note All the relevant data are attached to the parent dialogue window.
*/
-void
- save_passes (GtkWidget *parent)
+void save_passes (GtkWidget *parent)
{
GtkWidget *dialog;
GtkWidget *table;
@@ -407,8 +405,7 @@
* The function sets the state of the Save button according to the validity
* of the current file name.
*/
-static void
- file_changed (GtkWidget *widget, gpointer data)
+static void file_changed (GtkWidget *widget, gpointer data)
{
gchar *entry, *end, *j;
gint len, pos;
@@ -472,11 +469,10 @@
* \note The formatting is done by external functions according to the selected
* file format.
*/
-static void
- save_passes_exec (GtkWidget *parent,
- GSList *passes, qth_t *qth,
- const gchar *savedir, const gchar *savefile,
- gint format, gint contents)
+static void save_passes_exec (GtkWidget *parent,
+ GSList *passes, qth_t *qth,
+ const gchar *savedir, const gchar *savefile,
+ gint format, gint contents)
{
gchar *fname;
gchar *pgheader;
@@ -566,11 +562,10 @@
* \note The formatting is done by external functions according to the selected
* file format.
*/
-static void
- save_pass_exec (GtkWidget *parent,
- pass_t *pass, qth_t *qth,
- const gchar *savedir, const gchar *savefile,
- gint format, gint contents)
+static void save_pass_exec (GtkWidget *parent,
+ pass_t *pass, qth_t *qth,
+ const gchar *savedir, const gchar *savefile,
+ gint format, gint contents)
{
gchar *fname;
gchar *pgheader;
@@ -651,8 +646,7 @@
-static void
- save_to_file (GtkWidget *parent, const gchar *fname, const gchar *data)
+static void save_to_file (GtkWidget *parent, const gchar *fname, const gchar *data)
{
GIOChannel *chan;
GError *err = NULL;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cs...@us...> - 2009-12-27 01:28:05
|
Revision: 559
http://gpredict.svn.sourceforge.net/gpredict/?rev=559&view=rev
Author: csete
Date: 2009-12-27 00:12:09 +0000 (Sun, 27 Dec 2009)
Log Message:
-----------
Fixed indentation.
Modified Paths:
--------------
trunk/src/sat-pass-dialogs.c
trunk/src/save-pass.c
Modified: trunk/src/sat-pass-dialogs.c
===================================================================
--- trunk/src/sat-pass-dialogs.c 2009-12-26 23:03:45 UTC (rev 558)
+++ trunk/src/sat-pass-dialogs.c 2009-12-27 00:12:09 UTC (rev 559)
@@ -11,7 +11,7 @@
More details can be found at the project home page:
http://gpredict.oz9aec.net/
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
@@ -266,7 +266,7 @@
*
*/
void
-show_pass (const gchar *satname, qth_t *qth, pass_t *pass, GtkWidget *toplevel)
+ show_pass (const gchar *satname, qth_t *qth, pass_t *pass, GtkWidget *toplevel)
{
GtkWidget *dialog; /* the dialogue window */
GtkWidget *notebook; /* the notebook widet */
@@ -369,7 +369,7 @@
SINGLE_PASS_COL_MA, detail->ma,
SINGLE_PASS_COL_PHASE, detail->phase,
-1);
-
+
/* SINGLE_PASS_COL_RA */
/* SINGLE_PASS_COL_DEC */
if (flags & (SINGLE_PASS_FLAG_RA | SINGLE_PASS_FLAG_DEC)) {
@@ -516,7 +516,7 @@
g_signal_connect (dialog, "response",
G_CALLBACK (single_pass_response), NULL);
- g_signal_connect (dialog, "destroy",
+ g_signal_connect (dialog, "destroy",
G_CALLBACK (single_pass_dialog_destroy), NULL);
g_signal_connect (dialog, "delete_event",
G_CALLBACK (single_pass_dialog_delete), NULL);
@@ -539,7 +539,7 @@
*
*/
static void
-single_pass_response (GtkWidget *dialog, gint response, gpointer data)
+ single_pass_response (GtkWidget *dialog, gint response, gpointer data)
{
switch (response) {
@@ -547,7 +547,7 @@
case RESPONSE_PRINT:
sat_log_log (SAT_LOG_LEVEL_ERROR,
_("%s: PRINT not implemented"),
- __FUNCTION__);
+ __FUNCTION__);
break;
case RESPONSE_SAVE:
@@ -565,9 +565,9 @@
/** \brief Set cell renderer function. */
static void
-check_and_set_single_cell_renderer (GtkTreeViewColumn *column,
- GtkCellRenderer *renderer,
- gint i)
+ check_and_set_single_cell_renderer (GtkTreeViewColumn *column,
+ GtkCellRenderer *renderer,
+ gint i)
{
switch (i) {
@@ -661,11 +661,11 @@
original flaoting point numbers. Very cool!
*/
static void
-latlon_cell_data_function (GtkTreeViewColumn *col,
- GtkCellRenderer *renderer,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer column)
+ latlon_cell_data_function (GtkTreeViewColumn *col,
+ GtkCellRenderer *renderer,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer column)
{
gdouble number = 0.0;
gchar *buff;
@@ -718,11 +718,11 @@
/* general floats with 2 digits + degree char */
static void
-degree_cell_data_function (GtkTreeViewColumn *col,
- GtkCellRenderer *renderer,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer column)
+ degree_cell_data_function (GtkTreeViewColumn *col,
+ GtkCellRenderer *renderer,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer column)
{
gdouble number;
gchar *buff;
@@ -742,11 +742,11 @@
/* distance and velocity, 0 decimal digits */
static void
-distance_cell_data_function (GtkTreeViewColumn *col,
- GtkCellRenderer *renderer,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer column)
+ distance_cell_data_function (GtkTreeViewColumn *col,
+ GtkCellRenderer *renderer,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer column)
{
gdouble number;
gchar *buff;
@@ -771,11 +771,11 @@
and want 2-3 decimal digits.
*/
static void
-range_rate_cell_data_function (GtkTreeViewColumn *col,
- GtkCellRenderer *renderer,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer column)
+ range_rate_cell_data_function (GtkTreeViewColumn *col,
+ GtkCellRenderer *renderer,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer column)
{
gdouble number;
gchar *buff;
@@ -798,11 +798,11 @@
/* 0 decimal digits */
static void
-float_to_int_cell_data_function (GtkTreeViewColumn *col,
- GtkCellRenderer *renderer,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer column)
+ float_to_int_cell_data_function (GtkTreeViewColumn *col,
+ GtkCellRenderer *renderer,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer column)
{
gdouble number;
gchar *buff;
@@ -820,11 +820,11 @@
/* 2 decimal digits */
static void
-two_dec_cell_data_function (GtkTreeViewColumn *col,
- GtkCellRenderer *renderer,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer column)
+ two_dec_cell_data_function (GtkTreeViewColumn *col,
+ GtkCellRenderer *renderer,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer column)
{
gdouble number;
gchar *buff;
@@ -843,11 +843,11 @@
/* AOS/LOS; convert julian date to string */
static void
-time_cell_data_function (GtkTreeViewColumn *col,
- GtkCellRenderer *renderer,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer column)
+ time_cell_data_function (GtkTreeViewColumn *col,
+ GtkCellRenderer *renderer,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer column)
{
gdouble number;
gchar buff[TIME_FORMAT_MAX_LENGTH];
@@ -899,14 +899,14 @@
static gint
-single_pass_dialog_delete (GtkWidget *dialog, GdkEvent *event, gpointer pass)
+ single_pass_dialog_delete (GtkWidget *dialog, GdkEvent *event, gpointer pass)
{
/* dialog will be destroyed */
return FALSE;
}
static void
-single_pass_dialog_destroy (GtkWidget *dialog, gpointer data)
+ single_pass_dialog_destroy (GtkWidget *dialog, gpointer data)
{
pass_t *pass = PASS(g_object_get_data (G_OBJECT (dialog), "pass"));
@@ -918,13 +918,13 @@
/*** FIXME: formalise with other copies */
static void
-Calc_RADec (gdouble jul_utc, gdouble saz, gdouble sel,
- qth_t *qth, obs_astro_t *obs_set)
+ Calc_RADec (gdouble jul_utc, gdouble saz, gdouble sel,
+ qth_t *qth, obs_astro_t *obs_set)
{
double phi,theta,sin_theta,cos_theta,sin_phi,cos_phi,
- az,el,Lxh,Lyh,Lzh,Sx,Ex,Zx,Sy,Ey,Zy,Sz,Ez,Zz,
- Lx,Ly,Lz,cos_delta,sin_alpha,cos_alpha;
+ az,el,Lxh,Lyh,Lzh,Sx,Ex,Zx,Sy,Ey,Zy,Sz,Ez,Zz,
+ Lx,Ly,Lz,cos_delta,sin_alpha,cos_alpha;
geodetic_t geodetic;
@@ -979,7 +979,7 @@
*
*/
void
-show_passes (const gchar *satname, qth_t *qth, GSList *passes, GtkWidget *toplevel)
+ show_passes (const gchar *satname, qth_t *qth, GSList *passes, GtkWidget *toplevel)
{
GtkWidget *dialog;
GtkWidget *list;
@@ -1152,14 +1152,14 @@
*
*/
static void
-multi_pass_response (GtkWidget *dialog, gint response, gpointer data)
+ multi_pass_response (GtkWidget *dialog, gint response, gpointer data)
{
switch (response) {
case RESPONSE_PRINT:
sat_log_log (SAT_LOG_LEVEL_ERROR,
_("%s: PRINT not implemented"),
- __FUNCTION__);
+ __FUNCTION__);
break;
case RESPONSE_SAVE:
@@ -1176,7 +1176,7 @@
static gint
-multi_pass_dialog_delete (GtkWidget *dialog, GdkEvent *event, gpointer pass)
+ multi_pass_dialog_delete (GtkWidget *dialog, GdkEvent *event, gpointer pass)
{
/* dialog will be destroyed */
return FALSE;
@@ -1184,7 +1184,7 @@
static void
-multi_pass_dialog_destroy (GtkWidget *dialog, gpointer data)
+ multi_pass_dialog_destroy (GtkWidget *dialog, gpointer data)
{
GSList *passes = (GSList *) g_object_get_data (G_OBJECT (dialog), "passes");
@@ -1197,9 +1197,9 @@
/** \brief Set cell renderer function. */
static void
-check_and_set_multi_cell_renderer (GtkTreeViewColumn *column,
- GtkCellRenderer *renderer,
- gint i)
+ check_and_set_multi_cell_renderer (GtkTreeViewColumn *column,
+ GtkCellRenderer *renderer,
+ gint i)
{
switch (i) {
@@ -1247,11 +1247,11 @@
/* duration; convert delta t in days to HH:MM:SS */
static void
-duration_cell_data_function (GtkTreeViewColumn *col,
- GtkCellRenderer *renderer,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer column)
+ duration_cell_data_function (GtkTreeViewColumn *col,
+ GtkCellRenderer *renderer,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer column)
{
gdouble number;
gchar *buff;
@@ -1324,7 +1324,7 @@
* for the function that actually creates the popup menu.
*/
static gboolean
-popup_menu_cb (GtkWidget *treeview, gpointer data)
+ popup_menu_cb (GtkWidget *treeview, gpointer data)
{
/* if there is no selection, select the first row */
@@ -1343,7 +1343,7 @@
*
*/
static gboolean
-button_press_cb (GtkWidget *treeview, GdkEventButton *event, gpointer data)
+ button_press_cb (GtkWidget *treeview, GdkEventButton *event, gpointer data)
{
/* single click with the right mouse button? */
@@ -1385,7 +1385,7 @@
static void
-view_popup_menu (GtkWidget *treeview, GdkEventButton *event, gpointer data)
+ view_popup_menu (GtkWidget *treeview, GdkEventButton *event, gpointer data)
{
GtkTreeSelection *selection;
GtkTreeModel *model;
@@ -1413,8 +1413,8 @@
pass = copy_pass (PASS (g_slist_nth_data (passes, rownum)));
pass_popup_menu_exec (qth, pass, event, gtk_widget_get_toplevel (treeview));
-
+
}
else {
sat_log_log (SAT_LOG_LEVEL_BUG,
Modified: trunk/src/save-pass.c
===================================================================
--- trunk/src/save-pass.c 2009-12-26 23:03:45 UTC (rev 558)
+++ trunk/src/save-pass.c 2009-12-27 00:12:09 UTC (rev 559)
@@ -11,17 +11,17 @@
More details can be found at the project home page:
http://gpredict.oz9aec.net/
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program; if not, visit http://www.fsf.org/
*/
@@ -49,25 +49,25 @@
static void file_changed (GtkWidget *widget, gpointer data);
static void save_pass_exec (GtkWidget *parent,
- pass_t *pass, qth_t *qth,
- const gchar *savedir, const gchar *savefile,
- gint format, gint contents);
+ pass_t *pass, qth_t *qth,
+ const gchar *savedir, const gchar *savefile,
+ gint format, gint contents);
static void save_passes_exec (GtkWidget *parent,
- GSList *passes, qth_t *qth,
- const gchar *savedir, const gchar *savefile,
- gint format, gint contents);
+ GSList *passes, qth_t *qth,
+ const gchar *savedir, const gchar *savefile,
+ gint format, gint contents);
static void save_to_file (GtkWidget *parent, const gchar *fname, const gchar *data);
enum pass_content_e {
- PASS_CONTENT_ALL = 0,
- PASS_CONTENT_TABLE,
- PASS_CONTENT_DATA,
+ PASS_CONTENT_ALL = 0,
+ PASS_CONTENT_TABLE,
+ PASS_CONTENT_DATA,
};
enum passes_content_e {
- PASSES_CONTENT_FULL = 0,
- PASSES_CONTENT_SUM,
+ PASSES_CONTENT_FULL = 0,
+ PASSES_CONTENT_SUM,
};
@@ -85,152 +85,152 @@
* \note All the relevant data are attached to the parent dialogue window.
*/
void
-save_pass (GtkWidget *parent)
+ save_pass (GtkWidget *parent)
{
- GtkWidget *dialog;
- GtkWidget *table;
- GtkWidget *dirchooser;
- GtkWidget *filchooser;
- GtkWidget *fmtchooser;
- GtkWidget *contents;
- GtkWidget *label;
- gint response;
- pass_t *pass;
- gchar *sat;
- qth_t *qth;
- gchar *savedir = NULL;
- gchar *savefile;
- gint format;
- gint cont;
+ GtkWidget *dialog;
+ GtkWidget *table;
+ GtkWidget *dirchooser;
+ GtkWidget *filchooser;
+ GtkWidget *fmtchooser;
+ GtkWidget *contents;
+ GtkWidget *label;
+ gint response;
+ pass_t *pass;
+ gchar *sat;
+ qth_t *qth;
+ gchar *savedir = NULL;
+ gchar *savefile;
+ gint format;
+ gint cont;
- /* get data attached to parent */
- sat = (gchar *) g_object_get_data (G_OBJECT (parent), "sat");
- qth = (qth_t *) g_object_get_data (G_OBJECT (parent), "qth");
- pass = (pass_t *) g_object_get_data (G_OBJECT (parent), "pass");
+ /* get data attached to parent */
+ sat = (gchar *) g_object_get_data (G_OBJECT (parent), "sat");
+ qth = (qth_t *) g_object_get_data (G_OBJECT (parent), "qth");
+ pass = (pass_t *) g_object_get_data (G_OBJECT (parent), "pass");
-
- /* create the dialog */
- dialog = gtk_dialog_new_with_buttons (_("Save Pass Details"), GTK_WINDOW (parent),
- GTK_DIALOG_MODAL |
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_CANCEL,
- GTK_RESPONSE_REJECT,
- GTK_STOCK_SAVE,
- GTK_RESPONSE_ACCEPT,
- NULL);
- gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
+ /* create the dialog */
+ dialog = gtk_dialog_new_with_buttons (_("Save Pass Details"), GTK_WINDOW (parent),
+ GTK_DIALOG_MODAL |
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_REJECT,
+ GTK_STOCK_SAVE,
+ GTK_RESPONSE_ACCEPT,
+ NULL);
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
- /* create the table */
- table = gtk_table_new (4, 2, FALSE);
- gtk_table_set_col_spacings (GTK_TABLE (table), 10);
- gtk_table_set_row_spacings (GTK_TABLE (table), 10);
- gtk_container_set_border_width (GTK_CONTAINER (table), 10);
- /* directory chooser */
- label = gtk_label_new (_("Save in folder:"));
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 0, 1);
+ /* create the table */
+ table = gtk_table_new (4, 2, FALSE);
+ gtk_table_set_col_spacings (GTK_TABLE (table), 10);
+ gtk_table_set_row_spacings (GTK_TABLE (table), 10);
+ gtk_container_set_border_width (GTK_CONTAINER (table), 10);
- dirchooser = gtk_file_chooser_button_new (_("Select a folder"),
- GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
- savedir = sat_cfg_get_str (SAT_CFG_STR_PRED_SAVE_DIR);
- if (savedir) {
- gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dirchooser), savedir);
- g_free (savedir);
- }
- else {
- gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dirchooser),
- g_get_home_dir ());
- }
- gtk_table_attach_defaults (GTK_TABLE (table), dirchooser, 1, 2, 0, 1);
+ /* directory chooser */
+ label = gtk_label_new (_("Save in folder:"));
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 0, 1);
- /* file name */
- label = gtk_label_new (_("Save using file name:"));
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 1, 2);
+ dirchooser = gtk_file_chooser_button_new (_("Select a folder"),
+ GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
+ savedir = sat_cfg_get_str (SAT_CFG_STR_PRED_SAVE_DIR);
+ if (savedir) {
+ gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dirchooser), savedir);
+ g_free (savedir);
+ }
+ else {
+ gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dirchooser),
+ g_get_home_dir ());
+ }
+ gtk_table_attach_defaults (GTK_TABLE (table), dirchooser, 1, 2, 0, 1);
- filchooser = gtk_entry_new ();
- gtk_entry_set_max_length (GTK_ENTRY (filchooser), 100);
- g_signal_connect (filchooser, "changed", G_CALLBACK (file_changed), dialog);
- gtk_table_attach_defaults (GTK_TABLE (table), filchooser, 1, 2, 1, 2);
+ /* file name */
+ label = gtk_label_new (_("Save using file name:"));
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 1, 2);
- /* use satellite name + orbit num as default; replace invalid characters
+ filchooser = gtk_entry_new ();
+ gtk_entry_set_max_length (GTK_ENTRY (filchooser), 100);
+ g_signal_connect (filchooser, "changed", G_CALLBACK (file_changed), dialog);
+ gtk_table_attach_defaults (GTK_TABLE (table), filchooser, 1, 2, 1, 2);
+
+ /* use satellite name + orbit num as default; replace invalid characters
with dash */
- savefile = g_strdup_printf ("%s-%d", pass->satname, pass->orbit);
- savefile = g_strdelimit (savefile, " ", '-');
- savefile = g_strdelimit (savefile, "!?/\()*&%$#@[]{}=+<>,.|:;", '_');
- gtk_entry_set_text (GTK_ENTRY (filchooser), savefile);
- g_free (savefile);
-
+ savefile = g_strdup_printf ("%s-%d", pass->satname, pass->orbit);
+ savefile = g_strdelimit (savefile, " ", '-');
+ savefile = g_strdelimit (savefile, "!?/\()*&%$#@[]{}=+<>,.|:;", '_');
+ gtk_entry_set_text (GTK_ENTRY (filchooser), savefile);
+ g_free (savefile);
- /* file format */
- label = gtk_label_new (_("Save as:"));
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 2, 3);
- fmtchooser = gtk_combo_box_new_text ();
- gtk_combo_box_append_text (GTK_COMBO_BOX (fmtchooser), _("Plain text (*.txt)"));
-/* gtk_combo_box_append_text (GTK_COMBO_BOX (fmtchooser), _("Hypertext (*.html)")); */
-/* gtk_combo_box_append_text (GTK_COMBO_BOX (fmtchooser), _("Docbook (*.xml)")); */
- gtk_combo_box_set_active (GTK_COMBO_BOX (fmtchooser),
- sat_cfg_get_int (SAT_CFG_INT_PRED_SAVE_FORMAT));
- gtk_table_attach_defaults (GTK_TABLE (table), fmtchooser, 1, 2, 2, 3);
+ /* file format */
+ label = gtk_label_new (_("Save as:"));
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 2, 3);
- gtk_widget_set_sensitive (fmtchooser, FALSE);
+ fmtchooser = gtk_combo_box_new_text ();
+ gtk_combo_box_append_text (GTK_COMBO_BOX (fmtchooser), _("Plain text (*.txt)"));
+ /* gtk_combo_box_append_text (GTK_COMBO_BOX (fmtchooser), _("Hypertext (*.html)")); */
+ /* gtk_combo_box_append_text (GTK_COMBO_BOX (fmtchooser), _("Docbook (*.xml)")); */
+ gtk_combo_box_set_active (GTK_COMBO_BOX (fmtchooser),
+ sat_cfg_get_int (SAT_CFG_INT_PRED_SAVE_FORMAT));
+ gtk_table_attach_defaults (GTK_TABLE (table), fmtchooser, 1, 2, 2, 3);
- /* file contents */
- label = gtk_label_new (_("File contents:"));
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 3, 4);
+ gtk_widget_set_sensitive (fmtchooser, FALSE);
- contents = gtk_combo_box_new_text ();
- gtk_combo_box_append_text (GTK_COMBO_BOX (contents), _("Info+header+data"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (contents), _("Header + data"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (contents), _("Data only"));
- gtk_combo_box_set_active (GTK_COMBO_BOX (contents),
- sat_cfg_get_int (SAT_CFG_INT_PRED_SAVE_CONTENTS));
- gtk_table_attach_defaults (GTK_TABLE (table), contents, 1, 2, 3, 4);
-
- gtk_widget_show_all (table);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), table);
-
+ /* file contents */
+ label = gtk_label_new (_("File contents:"));
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 3, 4);
- /* run the dialog */
- response = gtk_dialog_run (GTK_DIALOG (dialog));
+ contents = gtk_combo_box_new_text ();
+ gtk_combo_box_append_text (GTK_COMBO_BOX (contents), _("Info+header+data"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (contents), _("Header + data"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (contents), _("Data only"));
+ gtk_combo_box_set_active (GTK_COMBO_BOX (contents),
+ sat_cfg_get_int (SAT_CFG_INT_PRED_SAVE_CONTENTS));
+ gtk_table_attach_defaults (GTK_TABLE (table), contents, 1, 2, 3, 4);
- switch (response) {
+ gtk_widget_show_all (table);
+ gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), table);
- /* user clicked the save button */
- case GTK_RESPONSE_ACCEPT:
- /* get file and directory */
- savedir = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dirchooser));
- savefile = g_strdup (gtk_entry_get_text (GTK_ENTRY (filchooser)));
- format = gtk_combo_box_get_active (GTK_COMBO_BOX (fmtchooser));
- cont = gtk_combo_box_get_active (GTK_COMBO_BOX (contents));
+ /* run the dialog */
+ response = gtk_dialog_run (GTK_DIALOG (dialog));
- /* call saver */
- save_pass_exec (dialog, pass, qth, savedir, savefile, format, cont);
+ switch (response) {
- /* store new settings */
- sat_cfg_set_str (SAT_CFG_STR_PRED_SAVE_DIR, savedir);
- sat_cfg_set_int (SAT_CFG_INT_PRED_SAVE_FORMAT, format);
- sat_cfg_set_int (SAT_CFG_INT_PRED_SAVE_CONTENTS, cont);
+ /* user clicked the save button */
+ case GTK_RESPONSE_ACCEPT:
- /* clean up */
- g_free (savedir);
- g_free (savefile);
- break;
+ /* get file and directory */
+ savedir = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dirchooser));
+ savefile = g_strdup (gtk_entry_get_text (GTK_ENTRY (filchooser)));
+ format = gtk_combo_box_get_active (GTK_COMBO_BOX (fmtchooser));
+ cont = gtk_combo_box_get_active (GTK_COMBO_BOX (contents));
- /* cancel */
- default:
- break;
+ /* call saver */
+ save_pass_exec (dialog, pass, qth, savedir, savefile, format, cont);
- }
+ /* store new settings */
+ sat_cfg_set_str (SAT_CFG_STR_PRED_SAVE_DIR, savedir);
+ sat_cfg_set_int (SAT_CFG_INT_PRED_SAVE_FORMAT, format);
+ sat_cfg_set_int (SAT_CFG_INT_PRED_SAVE_CONTENTS, cont);
- gtk_widget_destroy (dialog);
+ /* clean up */
+ g_free (savedir);
+ g_free (savefile);
+ break;
+
+ /* cancel */
+ default:
+ break;
+
+ }
+
+ gtk_widget_destroy (dialog);
}
@@ -249,150 +249,150 @@
* \note All the relevant data are attached to the parent dialogue window.
*/
void
-save_passes (GtkWidget *parent)
+ save_passes (GtkWidget *parent)
{
- GtkWidget *dialog;
- GtkWidget *table;
- GtkWidget *dirchooser;
- GtkWidget *filchooser;
- GtkWidget *fmtchooser;
- GtkWidget *contents;
- GtkWidget *label;
- gint response;
- GSList *passes;
- gchar *sat;
- qth_t *qth;
- gchar *savedir = NULL;
- gchar *savefile;
- gint format;
- gint cont;
+ GtkWidget *dialog;
+ GtkWidget *table;
+ GtkWidget *dirchooser;
+ GtkWidget *filchooser;
+ GtkWidget *fmtchooser;
+ GtkWidget *contents;
+ GtkWidget *label;
+ gint response;
+ GSList *passes;
+ gchar *sat;
+ qth_t *qth;
+ gchar *savedir = NULL;
+ gchar *savefile;
+ gint format;
+ gint cont;
- /* get data attached to parent */
- sat = (gchar *) g_object_get_data (G_OBJECT (parent), "sat");
- qth = (qth_t *) g_object_get_data (G_OBJECT (parent), "qth");
- passes = (GSList *) g_object_get_data (G_OBJECT (parent), "passes");
+ /* get data attached to parent */
+ sat = (gchar *) g_object_get_data (G_OBJECT (parent), "sat");
+ qth = (qth_t *) g_object_get_data (G_OBJECT (parent), "qth");
+ passes = (GSList *) g_object_get_data (G_OBJECT (parent), "passes");
-
- /* create the dialog */
- dialog = gtk_dialog_new_with_buttons (_("Save Passes"), GTK_WINDOW (parent),
- GTK_DIALOG_MODAL |
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_CANCEL,
- GTK_RESPONSE_REJECT,
- GTK_STOCK_SAVE,
- GTK_RESPONSE_ACCEPT,
- NULL);
- gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
+ /* create the dialog */
+ dialog = gtk_dialog_new_with_buttons (_("Save Passes"), GTK_WINDOW (parent),
+ GTK_DIALOG_MODAL |
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_REJECT,
+ GTK_STOCK_SAVE,
+ GTK_RESPONSE_ACCEPT,
+ NULL);
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
- /* create the table */
- table = gtk_table_new (4, 2, FALSE);
- gtk_table_set_col_spacings (GTK_TABLE (table), 10);
- gtk_table_set_row_spacings (GTK_TABLE (table), 10);
- gtk_container_set_border_width (GTK_CONTAINER (table), 10);
- /* directory chooser */
- label = gtk_label_new (_("Save in folder:"));
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 0, 1);
+ /* create the table */
+ table = gtk_table_new (4, 2, FALSE);
+ gtk_table_set_col_spacings (GTK_TABLE (table), 10);
+ gtk_table_set_row_spacings (GTK_TABLE (table), 10);
+ gtk_container_set_border_width (GTK_CONTAINER (table), 10);
- dirchooser = gtk_file_chooser_button_new (_("Select a folder"),
- GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
- savedir = sat_cfg_get_str (SAT_CFG_STR_PRED_SAVE_DIR);
- if (savedir) {
- gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dirchooser), savedir);
- g_free (savedir);
- }
- else {
- gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dirchooser),
- g_get_home_dir ());
- }
- gtk_table_attach_defaults (GTK_TABLE (table), dirchooser, 1, 2, 0, 1);
+ /* directory chooser */
+ label = gtk_label_new (_("Save in folder:"));
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 0, 1);
- /* file name */
- label = gtk_label_new (_("Save using file name:"));
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 1, 2);
+ dirchooser = gtk_file_chooser_button_new (_("Select a folder"),
+ GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
+ savedir = sat_cfg_get_str (SAT_CFG_STR_PRED_SAVE_DIR);
+ if (savedir) {
+ gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dirchooser), savedir);
+ g_f...
[truncated message content] |
|
From: <cs...@us...> - 2010-01-02 22:59:57
|
Revision: 571
http://gpredict.svn.sourceforge.net/gpredict/?rev=571&view=rev
Author: csete
Date: 2010-01-02 22:59:47 +0000 (Sat, 02 Jan 2010)
Log Message:
-----------
Added utility function to retrieve newest EPOCH of satellites in database.
Modified Paths:
--------------
trunk/src/gtk-sat-selector.c
trunk/src/gtk-sat-selector.h
Modified: trunk/src/gtk-sat-selector.c
===================================================================
--- trunk/src/gtk-sat-selector.c 2010-01-02 22:04:42 UTC (rev 570)
+++ trunk/src/gtk-sat-selector.c 2010-01-02 22:59:47 UTC (rev 571)
@@ -734,3 +734,44 @@
}
}
+
+
+
+/** \brief Get the latest EPOCH of the satellites that are loaded into the GtkSatSelector.
+ * \param selector Pointer to the GtkSatSelector widget.
+ * \return The latest EPOCH or 0.0 in case an error occurs.
+ */
+gdouble gtk_sat_selector_get_latest_epoch (GtkSatSelector *selector)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gdouble epoch = 0.0;
+ gdouble thisepoch;
+ gint i,n;
+
+
+ g_return_val_if_fail (selector != 0 && IS_GTK_SAT_SELECTOR (selector), 0.0);
+
+
+ /* get the tree model that contains all satellites */
+ model = GTK_TREE_MODEL (g_slist_nth_data (selector->models, 0));
+ n = gtk_tree_model_iter_n_children (model,NULL);
+
+ /* loop over each satellite in the model and store the newest EPOCH */
+ for (i = 0; i < n; i++) {
+ if G_LIKELY(gtk_tree_model_iter_nth_child (model, &iter, NULL, i)) {
+ gtk_tree_model_get (model, &iter,
+ GTK_SAT_SELECTOR_COL_EPOCH, &thisepoch,
+ -1);
+ if (thisepoch > epoch)
+ epoch = thisepoch;
+
+ }
+ else {
+ sat_log_log (SAT_LOG_LEVEL_ERROR,
+ _("%s: Error getting %dth satellite"), __FUNCTION__, i);
+ }
+ }
+
+ return epoch;
+}
Modified: trunk/src/gtk-sat-selector.h
===================================================================
--- trunk/src/gtk-sat-selector.h 2010-01-02 22:04:42 UTC (rev 570)
+++ trunk/src/gtk-sat-selector.h 2010-01-02 22:59:47 UTC (rev 571)
@@ -103,6 +103,7 @@
GtkWidget *gtk_sat_selector_new (guint flags);
guint32 gtk_sat_selector_get_flags (GtkSatSelector *selector);
void gtk_sat_selector_get_selected (GtkSatSelector *selector, gint *catnum, gchar **satname, gdouble *epoch);
+gdouble gtk_sat_selector_get_latest_epoch (GtkSatSelector *selector);
#ifdef __cplusplus
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cs...@us...> - 2010-01-17 21:24:13
|
Revision: 589
http://gpredict.svn.sourceforge.net/gpredict/?rev=589&view=rev
Author: csete
Date: 2010-01-17 21:24:03 +0000 (Sun, 17 Jan 2010)
Log Message:
-----------
Addided files print functions (not complete).
Modified Paths:
--------------
trunk/src/Makefile.am
Added Paths:
-----------
trunk/src/print-pass.c
trunk/src/print-pass.h
Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am 2010-01-12 18:32:19 UTC (rev 588)
+++ trunk/src/Makefile.am 2010-01-17 21:24:03 UTC (rev 589)
@@ -70,6 +70,7 @@
pass-popup-menu.c pass-popup-menu.h \
pass-to-txt.c pass-to-txt.h \
predict-tools.c predict-tools.h \
+ print-pass.c print-pass.h \
qth-data.c qth-data.h \
qth-editor.c qth-editor.h \
radio-conf.c radio-conf.h \
Added: trunk/src/print-pass.c
===================================================================
--- trunk/src/print-pass.c (rev 0)
+++ trunk/src/print-pass.c 2010-01-17 21:24:03 UTC (rev 589)
@@ -0,0 +1,310 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*
+ Gpredict: Real-time satellite tracking and orbit prediction program
+
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
+
+ Authors: Alexandru Csete <oz...@gm...>
+
+ Comments, questions and bugreports should be submitted via
+ http://sourceforge.net/projects/gpredict/
+ More details can be found at the project home page:
+
+ http://gpredict.oz9aec.net/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, visit http://www.fsf.org/
+*/
+#include <gtk/gtk.h>
+#include "sgpsdp/sgp4sdp4.h"
+#include "predict-tools.h"
+#include "gtk-sat-data.h"
+#include "sat-cfg.h"
+#include "sat-log.h"
+#include "pass-to-txt.h"
+#include "print-pass.h"
+#ifdef HAVE_CONFIG_H
+# include <build-config.h>
+#endif
+
+
+/* In points */
+#define HEADER_HEIGHT (10*72/25.4)
+#define HEADER_GAP (3*72/25.4)
+
+typedef struct
+{
+ //gchar *filename;
+ gdouble font_size;
+
+ gint lines_per_page;
+
+ gchar *pgheader;
+ gchar **lines;
+ gint num_lines;
+ gint num_pages;
+ gint fields;
+} PrintData;
+
+
+
+static void begin_print (GtkPrintOperation *operation,
+ GtkPrintContext *context,
+ gpointer user_data);
+static void draw_page (GtkPrintOperation *operation,
+ GtkPrintContext *context,
+ gint page_nr,
+ gpointer user_data);
+static void end_print (GtkPrintOperation *operation,
+ GtkPrintContext *context,
+ gpointer user_data);
+
+
+/** \brief Print a satellite pass.
+ * \param pass Pointer to the pass_t data
+ * \param qth Pointer to the qth_t structure
+ * \param parent Transient parent of the dialog, or NULL
+ *
+ * This function prints a satellite pass to the printer (or a file) using the
+ * Gtk+ printing API. The function takes the user configuration into account
+ * and only prints the selected columns. The font size will be adjusted so that
+ * one row can fit on one line. The function will also try to reduce the number
+ * of rows so that the whole pass can fit on one page:
+ *
+ * +-------------------------+
+ * | header |
+ * |------------+------------|
+ * | | |
+ * | | |
+ * | polar | az/el |
+ * | | |
+ * |------------+------------|
+ * | |
+ * | Table with data |
+ * | |
+ * | - - - - - - - - - - - |
+ * | - - - - - - - - - - - |
+ * | - - - - - - - - - - - |
+ * | - - - - - - - - - - - |
+ * | - - - - - - - - - - - |
+ * | - - - - - - - - - - - |
+ * | - - - - - - - - - - - |
+ * | |
+ * +-------------------------+
+ *
+ */
+void print_pass (pass_t *pass, qth_t *qth, GtkWindow *parent)
+{
+ gchar *text,*header,*buff;
+
+ GtkPrintOperation *operation;
+ PrintData *data;
+ GError *error = NULL;
+
+
+ /* TODO check pass and qth */
+
+
+ operation = gtk_print_operation_new ();
+ data = g_new0 (PrintData, 1);
+ data->font_size = 12.0; // FIXME
+
+ /* page header */
+ data->pgheader = g_strdup_printf (_("Pass details for %s (orbit %d)"), pass->satname, pass->orbit);
+
+ /* convert data to printable strings; we use existing pass_to_txt functions */
+ data->fields = sat_cfg_get_int (SAT_CFG_INT_PRED_SINGLE_COL);
+ header = pass_to_txt_tblheader (pass, qth, data->fields);
+ text = pass_to_txt_tblcontents (pass, qth, data->fields);
+ buff = g_strconcat (header, text, NULL);
+ data->lines = g_strsplit (buff, "\n", 0);
+ g_free (text);
+ g_free (header);
+ g_free (buff);
+
+ g_signal_connect (G_OBJECT (operation), "begin-print", G_CALLBACK (begin_print), data);
+ g_signal_connect (G_OBJECT (operation), "draw-page", G_CALLBACK (draw_page), data);
+ g_signal_connect (G_OBJECT (operation), "end-print", G_CALLBACK (end_print), data);
+
+ gtk_print_operation_set_use_full_page (operation, FALSE);
+ gtk_print_operation_set_unit (operation, GTK_UNIT_POINTS);
+
+ gtk_print_operation_run (operation, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
+ parent, &error);
+
+ g_object_unref (operation);
+
+
+ if (error) {
+ sat_log_log (SAT_LOG_LEVEL_ERROR,
+ "%s: %s", __FUNCTION__, error->message);
+
+ GtkWidget *dialog;
+
+ dialog = gtk_message_dialog_new (parent,
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ "%s", error->message);
+ g_error_free (error);
+
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy), NULL);
+
+ gtk_widget_show (dialog);
+ }
+
+
+}
+
+
+/** \brief Print passes
+ * \param passes A GSList containing pointers to pass_t data.
+ *
+ * Create a summary page, then for each pass_t call print_pass()
+ */
+void print_passes (GSList *passes)
+{
+ sat_log_log (SAT_LOG_LEVEL_BUG, _("%s: Not implemented!"), __FUNCTION__);
+}
+
+
+
+
+
+
+
+static void
+begin_print (GtkPrintOperation *operation,
+ GtkPrintContext *context,
+ gpointer user_data)
+{
+ PrintData *data = (PrintData *)user_data;
+ //char *contents;
+ int i;
+ double height;
+
+ height = gtk_print_context_get_height (context) - HEADER_HEIGHT - HEADER_GAP;
+
+ data->lines_per_page = floor (height / data->font_size);
+
+ //g_file_get_contents (data->filename, &contents, NULL, NULL);
+
+ //data->lines = g_strsplit (contents, "\n", 0);
+ //g_free (contents);
+
+ i = 0;
+ while (data->lines[i] != NULL)
+ i++;
+
+ data->num_lines = i;
+ data->num_pages = (data->num_lines - 1) / data->lines_per_page + 1;
+
+ gtk_print_operation_set_n_pages (operation, data->num_pages);
+}
+
+
+
+static void
+draw_page (GtkPrintOperation *operation,
+ GtkPrintContext *context,
+ gint page_nr,
+ gpointer user_data)
+{
+ PrintData *data = (PrintData *)user_data;
+ cairo_t *cr;
+ PangoLayout *layout;
+ gint text_width, text_height;
+ gdouble width;
+ gint line, i;
+ PangoFontDescription *desc;
+ gchar *page_str;
+
+
+
+ cr = gtk_print_context_get_cairo_context (context);
+
+ width = gtk_print_context_get_width (context);
+
+ cairo_rectangle (cr, 0, 0, width, HEADER_HEIGHT);
+
+ cairo_set_source_rgb (cr, 0.8, 0.8, 0.8);
+ cairo_fill_preserve (cr);
+
+ cairo_set_source_rgb (cr, 0, 0, 0);
+ cairo_set_line_width (cr, 1);
+ cairo_stroke (cr);
+
+
+ layout = gtk_print_context_create_pango_layout (context);
+
+ desc = pango_font_description_from_string ("sans 14");
+ pango_layout_set_font_description (layout, desc);
+ pango_font_description_free (desc);
+
+ pango_layout_set_text (layout, data->pgheader, -1);
+ pango_layout_get_pixel_size (layout, &text_width, &text_height);
+
+ if (text_width > width) {
+ pango_layout_set_width (layout, width);
+ pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_START);
+ pango_layout_get_pixel_size (layout, &text_width, &text_height);
+ }
+
+ cairo_move_to (cr, (width - text_width) / 2, (HEADER_HEIGHT - text_height) / 2);
+ pango_cairo_show_layout (cr, layout);
+
+ page_str = g_strdup_printf ("%d/%d", page_nr + 1, data->num_pages);
+ pango_layout_set_text (layout, page_str, -1);
+ g_free (page_str);
+
+ pango_layout_set_width (layout, -1);
+ pango_layout_get_pixel_size (layout, &text_width, &text_height);
+ cairo_move_to (cr, width - text_width - 4, (HEADER_HEIGHT - text_height) / 2);
+ pango_cairo_show_layout (cr, layout);
+
+ g_object_unref (layout);
+
+ layout = gtk_print_context_create_pango_layout (context);
+
+ desc = pango_font_description_from_string ("monospace");
+ pango_font_description_set_size (desc, data->font_size * PANGO_SCALE);
+ pango_layout_set_font_description (layout, desc);
+ pango_font_description_free (desc);
+
+ cairo_move_to (cr, 0, HEADER_HEIGHT + HEADER_GAP);
+ line = page_nr * data->lines_per_page;
+ for (i = 0; i < data->lines_per_page && line < data->num_lines; i++) {
+ pango_layout_set_text (layout, data->lines[line], -1);
+ pango_cairo_show_layout (cr, layout);
+ cairo_rel_move_to (cr, 0, data->font_size);
+ line++;
+ }
+
+ g_object_unref (layout);
+}
+
+
+/**
+ *
+ */
+static void end_print (GtkPrintOperation *operation,
+ GtkPrintContext *context,
+ gpointer user_data)
+{
+ PrintData *data = (PrintData *)user_data;
+
+ g_free (data->pgheader);
+ g_strfreev (data->lines);
+ g_free (data);
+}
Added: trunk/src/print-pass.h
===================================================================
--- trunk/src/print-pass.h (rev 0)
+++ trunk/src/print-pass.h 2010-01-17 21:24:03 UTC (rev 589)
@@ -0,0 +1,41 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*
+ Gpredict: Real-time satellite tracking and orbit prediction program
+
+ Copyright (C) 2001-2009 Alexandru Csete, OZ9AEC.
+
+ Authors: Alexandru Csete <oz...@gm...>
+
+ Comments, questions and bugreports should be submitted via
+ http://sourceforge.net/projects/gpredict/
+ More details can be found at the project home page:
+
+ http://gpredict.oz9aec.net/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, visit http://www.fsf.org/
+*/
+#ifndef SAVE_PASS_H
+#define SAVE_PASS_H 1
+
+#include <gtk/gtk.h>
+#include "sat-pass-dialogs.h"
+#include "predict-tools.h"
+#include "gtk-sat-data.h"
+
+
+void print_pass (pass_t *pass, qth_t *qth, GtkWindow *parent);
+void print_passes (GSList *passes);
+
+
+#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cs...@us...> - 2010-02-05 13:48:09
|
Revision: 602
http://gpredict.svn.sourceforge.net/gpredict/?rev=602&view=rev
Author: csete
Date: 2010-02-05 13:48:03 +0000 (Fri, 05 Feb 2010)
Log Message:
-----------
Applied patch 2943448: Remove Segfault from corrupted module.
Modified Paths:
--------------
trunk/src/gtk-rig-ctrl.c
trunk/src/gtk-rot-ctrl.c
Modified: trunk/src/gtk-rig-ctrl.c
===================================================================
--- trunk/src/gtk-rig-ctrl.c 2010-02-05 13:35:24 UTC (rev 601)
+++ trunk/src/gtk-rig-ctrl.c 2010-02-05 13:48:03 UTC (rev 602)
@@ -259,11 +259,12 @@
/* store QTH */
GTK_RIG_CTRL (widget)->qth = module->qth;
- /* get next pass for target satellite */
- GTK_RIG_CTRL (widget)->pass = get_next_pass (GTK_RIG_CTRL (widget)->target,
- GTK_RIG_CTRL (widget)->qth,
- 3.0);
-
+ if (GTK_RIG_CTRL(widget)->target !=NULL) {
+ /* get next pass for target satellite */
+ GTK_RIG_CTRL (widget)->pass = get_next_pass (GTK_RIG_CTRL (widget)->target,
+ GTK_RIG_CTRL (widget)->qth,
+ 3.0);
+ }
/* initialise custom colors */
gdk_rgb_find_color (gtk_widget_get_colormap (widget), &ColBlack);
gdk_rgb_find_color (gtk_widget_get_colormap (widget), &ColWhite);
Modified: trunk/src/gtk-rot-ctrl.c
===================================================================
--- trunk/src/gtk-rot-ctrl.c 2010-02-05 13:35:24 UTC (rev 601)
+++ trunk/src/gtk-rot-ctrl.c 2010-02-05 13:48:03 UTC (rev 602)
@@ -219,18 +219,19 @@
GTK_ROT_CTRL (widget)->qth = module->qth;
/* get next pass for target satellite */
- if (GTK_ROT_CTRL (widget)->target->el > 0.0) {
- GTK_ROT_CTRL (widget)->pass = get_current_pass (GTK_ROT_CTRL (widget)->target,
- GTK_ROT_CTRL (widget)->qth,
- 0.0);
- }
- else {
- GTK_ROT_CTRL (widget)->pass = get_next_pass (GTK_ROT_CTRL (widget)->target,
- GTK_ROT_CTRL (widget)->qth,
- 3.0);
- }
-
-
+ if (GTK_ROT_CTRL (widget)->target){
+ if (GTK_ROT_CTRL (widget)->target->el > 0.0) {
+ GTK_ROT_CTRL (widget)->pass = get_current_pass (GTK_ROT_CTRL (widget)->target,
+ GTK_ROT_CTRL (widget)->qth,
+ 0.0);
+ }
+ else {
+ GTK_ROT_CTRL (widget)->pass = get_next_pass (GTK_ROT_CTRL (widget)->target,
+ GTK_ROT_CTRL (widget)->qth,
+ 3.0);
+ }
+ }
+
/* initialise custom colors */
gdk_rgb_find_color (gtk_widget_get_colormap (widget), &ColBlack);
gdk_rgb_find_color (gtk_widget_get_colormap (widget), &ColWhite);
@@ -815,7 +816,7 @@
set the rotor controller to 0 deg El and to the Az where the
target sat is expected to come up
*/
- if (ctrl->tracking) {
+ if (ctrl->tracking && ctrl->target) {
if (ctrl->target->el < 0.0) {
gdouble aosaz = 0.0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cs...@us...> - 2010-02-20 22:29:24
|
Revision: 610
http://gpredict.svn.sourceforge.net/gpredict/?rev=610&view=rev
Author: csete
Date: 2010-02-20 22:29:18 +0000 (Sat, 20 Feb 2010)
Log Message:
-----------
Replace RIG_TYPE_SPLIT with RIG_TYPE_TOGGLE (from patch 2955061).
Modified Paths:
--------------
trunk/src/gtk-rig-ctrl.c
trunk/src/radio-conf.h
trunk/src/sat-pref-rig.c
Modified: trunk/src/gtk-rig-ctrl.c
===================================================================
--- trunk/src/gtk-rig-ctrl.c 2010-02-15 22:18:29 UTC (rev 609)
+++ trunk/src/gtk-rig-ctrl.c 2010-02-20 22:29:18 UTC (rev 610)
@@ -103,16 +103,16 @@
static void exec_rx_cycle (GtkRigCtrl *ctrl);
static void exec_tx_cycle (GtkRigCtrl *ctrl);
static void exec_trx_cycle (GtkRigCtrl *ctrl);
-static void exec_split_cycle (GtkRigCtrl *ctrl);
-static void exec_split_tx_cycle (GtkRigCtrl *ctrl);
+static void exec_toggle_cycle (GtkRigCtrl *ctrl);
+static void exec_toggle_tx_cycle (GtkRigCtrl *ctrl);
static void exec_duplex_cycle (GtkRigCtrl *ctrl);
static void exec_dual_rig_cycle (GtkRigCtrl *ctrl);
static gboolean set_freq_simplex (GtkRigCtrl *ctrl, radio_conf_t *conf, gdouble freq);
static gboolean get_freq_simplex (GtkRigCtrl *ctrl, radio_conf_t *conf, gdouble *freq);
-static gboolean set_freq_split (GtkRigCtrl *ctrl, radio_conf_t *conf, gdouble freq);
-static gboolean set_split (GtkRigCtrl *ctrl, radio_conf_t *conf);
-static gboolean unset_split (GtkRigCtrl *ctrl, radio_conf_t *conf);
-static gboolean get_freq_split (GtkRigCtrl *ctrl, radio_conf_t *conf, gdouble *freq);
+static gboolean set_freq_toggle (GtkRigCtrl *ctrl, radio_conf_t *conf, gdouble freq);
+static gboolean set_toggle (GtkRigCtrl *ctrl, radio_conf_t *conf);
+static gboolean unset_toggle (GtkRigCtrl *ctrl, radio_conf_t *conf);
+static gboolean get_freq_toggle (GtkRigCtrl *ctrl, radio_conf_t *conf, gdouble *freq);
static gboolean get_ptt (GtkRigCtrl *ctrl, radio_conf_t *conf);
static gboolean set_vfo (GtkRigCtrl *ctrl, vfo_t vfo);
static void update_count_down (GtkRigCtrl *ctrl, gdouble t);
@@ -1179,8 +1179,8 @@
ctrl->lasttxf = 0.0;
ctrl->lastrxf = 0.0;
switch (ctrl->conf->type) {
- case RIG_TYPE_SPLIT:
- unset_split (ctrl,ctrl->conf);
+ case RIG_TYPE_TOGGLE:
+ unset_toggle (ctrl,ctrl->conf);
break;
default:
break;
@@ -1224,9 +1224,9 @@
exec_duplex_cycle (ctrl);
break;
- case RIG_TYPE_SPLIT:
- set_split (ctrl,ctrl->conf);
- exec_split_cycle (ctrl);
+ case RIG_TYPE_TOGGLE:
+ set_toggle (ctrl,ctrl->conf);
+ exec_toggle_cycle (ctrl);
break;
default:
@@ -1311,8 +1311,8 @@
exec_duplex_cycle (ctrl);
break;
- case RIG_TYPE_SPLIT:
- exec_split_cycle (ctrl);
+ case RIG_TYPE_TOGGLE:
+ exec_toggle_cycle (ctrl);
break;
default:
@@ -1587,24 +1587,24 @@
exec_tx_cycle (ctrl);
}
-/** \brief Execute split mode cycle.
+/** \brief Execute toggle mode cycle.
* \param ctrl Pointer to the GtkRigCtrl widget.
*
- * This function executes a controller cycle when the device is of RIG_TYPE_SPLIT.
+ * This function executes a controller cycle when the device is of RIG_TYPE_TOGGLE.
*/
-static void exec_split_cycle (GtkRigCtrl *ctrl)
+static void exec_toggle_cycle (GtkRigCtrl *ctrl)
{
exec_rx_cycle (ctrl);
- exec_split_tx_cycle (ctrl);
+ exec_toggle_tx_cycle (ctrl);
}
/** \brief Execute TX mode cycle.
* \param ctrl Pointer to the GtkRigCtrl widget.
*
- * This function executes a transmit cycle when the primary device is of RIG_TYPE_SPLIT.
+ * This function executes a transmit cycle when the primary device is of RIG_TYPE_TOGGLE.
*/
-static void exec_split_tx_cycle (GtkRigCtrl *ctrl)
+static void exec_toggle_tx_cycle (GtkRigCtrl *ctrl)
{
gdouble readfreq=0.0, tmpfreq, satfreqd, satfrequ;
gboolean ptt = TRUE;
@@ -1625,7 +1625,7 @@
if (ptt == TRUE) {
printf("PTT TRUE\n");
- if (!get_freq_split (ctrl, ctrl->conf, &readfreq)) {
+ if (!get_freq_toggle (ctrl, ctrl->conf, &readfreq)) {
/* error => use a passive value */
readfreq = ctrl->lasttxf;
ctrl->errcnt++;
@@ -1689,7 +1689,7 @@
/* if device is engaged, send freq command to radio */
if ((ctrl->engaged) && (fabs(ctrl->lasttxf - tmpfreq) >= 1.0)) {
- if (set_freq_split (ctrl, ctrl->conf, tmpfreq)) {
+ if (set_freq_toggle (ctrl, ctrl->conf, tmpfreq)) {
/* reset error counter */
ctrl->errcnt = 0;
@@ -1701,7 +1701,7 @@
smallest tuning step of 10 Hz). Therefore we read back the actual
frequency from the rig. */
if (ptt){
- get_freq_split (ctrl, ctrl->conf, &tmpfreq);
+ get_freq_toggle (ctrl, ctrl->conf, &tmpfreq);
}
ctrl->lasttxf = tmpfreq;
}
@@ -2153,7 +2153,7 @@
}
-/** \brief Set frequency in split mode
+/** \brief Set frequency in toggle mode
* \param ctrl Pointer to the GtkRigCtrl structure.
* \param freq The new frequency.
* \return TRUE if the operation was successful, FALSE if a connection error
@@ -2164,7 +2164,7 @@
* might become useful in the future.
*/
-static gboolean set_freq_split (GtkRigCtrl *ctrl, radio_conf_t *conf, gdouble freq)
+static gboolean set_freq_toggle (GtkRigCtrl *ctrl, radio_conf_t *conf, gdouble freq)
{
gchar *buff;
gint written,size;
@@ -2233,13 +2233,13 @@
}
-/** \brief Turn on the radios split mode
+/** \brief Turn on the radios toggle mode
* \param ctrl Pointer to the GtkRigCtrl structure.
* \return TRUE if the operation was successful, FALSE if a connection error
* occurred.
*
*/
-static gboolean set_split (GtkRigCtrl *ctrl, radio_conf_t *conf)
+static gboolean set_toggle (GtkRigCtrl *ctrl, radio_conf_t *conf)
{
gchar *buff;
gint written,size;
@@ -2307,14 +2307,14 @@
return TRUE;
}
-/** \brief Turn off the radios split mode
+/** \brief Turn off the radios toggle mode
* \param ctrl Pointer to the GtkRigCtrl structure.
* \return TRUE if the operation was successful, FALSE if a connection error
* occurred.
*
*/
-static gboolean unset_split (GtkRigCtrl *ctrl, radio_conf_t *conf)
+static gboolean unset_toggle (GtkRigCtrl *ctrl, radio_conf_t *conf)
{
gchar *buff;
gint written,size;
@@ -2504,14 +2504,14 @@
return TRUE;
}
-/** \brief Get frequency when the radio is working split
+/** \brief Get frequency when the radio is working toggle
* \param ctrl Pointer to the GtkRigCtrl structure.
* \param freq The current frequency of the radio.
* \return TRUE if the operation was successful, FALSE if a connection error
* occurred.
*/
-static gboolean get_freq_split (GtkRigCtrl *ctrl, radio_conf_t *conf, gdouble *freq)
+static gboolean get_freq_toggle (GtkRigCtrl *ctrl, radio_conf_t *conf, gdouble *freq)
{
gchar *buff,**vbuff;
gint written,size;
Modified: trunk/src/radio-conf.h
===================================================================
--- trunk/src/radio-conf.h 2010-02-15 22:18:29 UTC (rev 609)
+++ trunk/src/radio-conf.h 2010-02-20 22:29:18 UTC (rev 610)
@@ -39,8 +39,7 @@
RIG_TYPE_TX, /*!< Rig can only be used as transmitter */
RIG_TYPE_TRX, /*!< Rig can be used as RX/TX (simplex only) */
RIG_TYPE_DUPLEX, /*!< Rig is a full duplex radio, e.g. IC910 */
- RIG_TYPE_SPLIT /*!< Special mode for FT-817, 857 and 897
- FIXME: Find a better name because RIG_TYPE_TRX *is* actually split! */
+ RIG_TYPE_TOGGLE /*!< Special mode for FT-817, 857 and 897 */
} rig_type_t;
typedef enum {
Modified: trunk/src/sat-pref-rig.c
===================================================================
--- trunk/src/sat-pref-rig.c 2010-02-15 22:18:29 UTC (rev 609)
+++ trunk/src/sat-pref-rig.c 2010-02-20 22:29:18 UTC (rev 610)
@@ -714,7 +714,7 @@
g_object_set (renderer, "text", _("Duplex"), NULL);
break;
- case RIG_TYPE_SPLIT:
+ case RIG_TYPE_TOGGLE:
g_object_set (renderer, "text", _("FT817/857/897"), NULL);
break;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cs...@us...> - 2010-07-09 09:49:46
|
Revision: 624
http://gpredict.svn.sourceforge.net/gpredict/?rev=624&view=rev
Author: csete
Date: 2010-07-09 09:49:40 +0000 (Fri, 09 Jul 2010)
Log Message:
-----------
Added option for manual T/R switch for FT-817/857/897 (RIG_TYPE_TOGGLE_MAN). The auto mode has been renamed to RIG_TYPE_TOGGLE_AUTO.
Modified Paths:
--------------
trunk/src/gtk-rig-ctrl.c
trunk/src/radio-conf.h
trunk/src/sat-pref-rig-editor.c
trunk/src/sat-pref-rig.c
Modified: trunk/src/gtk-rig-ctrl.c
===================================================================
--- trunk/src/gtk-rig-ctrl.c 2010-07-09 09:31:17 UTC (rev 623)
+++ trunk/src/gtk-rig-ctrl.c 2010-07-09 09:49:40 UTC (rev 624)
@@ -1165,8 +1165,7 @@
*
* This function is called when the user toggles the "Engage" button.
*/
-static void
- rig_engaged_cb (GtkToggleButton *button, gpointer data)
+static void rig_engaged_cb (GtkToggleButton *button, gpointer data)
{
GtkRigCtrl *ctrl = GTK_RIG_CTRL (data);
@@ -1179,7 +1178,7 @@
ctrl->lasttxf = 0.0;
ctrl->lastrxf = 0.0;
switch (ctrl->conf->type) {
- case RIG_TYPE_TOGGLE:
+ case RIG_TYPE_TOGGLE_AUTO:
unset_toggle (ctrl,ctrl->conf);
break;
default:
@@ -1224,11 +1223,18 @@
exec_duplex_cycle (ctrl);
break;
- case RIG_TYPE_TOGGLE:
+ case RIG_TYPE_TOGGLE_AUTO:
set_toggle (ctrl,ctrl->conf);
exec_toggle_cycle (ctrl);
break;
+ case RIG_TYPE_TOGGLE_MAN:
+ /** FIXME **/
+ sat_log_log (SAT_LOG_LEVEL_BUG,
+ _("%s: Controller for RIG_TYPE_TOGGLE_MAN not implemented"),
+ __FUNCTION__);
+ break;
+
default:
/* this is an error! */
ctrl->conf->type = RIG_TYPE_RX;
@@ -1311,9 +1317,16 @@
exec_duplex_cycle (ctrl);
break;
- case RIG_TYPE_TOGGLE:
+ case RIG_TYPE_TOGGLE_AUTO:
exec_toggle_cycle (ctrl);
break;
+
+ case RIG_TYPE_TOGGLE_MAN:
+ /** FIXME **/
+ sat_log_log (SAT_LOG_LEVEL_BUG,
+ _("%s: Controller for RIG_TYPE_TOGGLE_MAN not implemented"),
+ __FUNCTION__);
+ break;
default:
/* invalid mode */
@@ -1590,7 +1603,7 @@
/** \brief Execute toggle mode cycle.
* \param ctrl Pointer to the GtkRigCtrl widget.
*
- * This function executes a controller cycle when the device is of RIG_TYPE_TOGGLE.
+ * This function executes a controller cycle when the device is of RIG_TYPE_TOGGLE_AUTO.
*/
static void exec_toggle_cycle (GtkRigCtrl *ctrl)
{
@@ -1601,7 +1614,7 @@
/** \brief Execute TX mode cycle.
* \param ctrl Pointer to the GtkRigCtrl widget.
*
- * This function executes a transmit cycle when the primary device is of RIG_TYPE_TOGGLE.
+ * This function executes a transmit cycle when the primary device is of RIG_TYPE_TOGGLE_AUTO.
*/
static void exec_toggle_tx_cycle (GtkRigCtrl *ctrl)
Modified: trunk/src/radio-conf.h
===================================================================
--- trunk/src/radio-conf.h 2010-07-09 09:31:17 UTC (rev 623)
+++ trunk/src/radio-conf.h 2010-07-09 09:49:40 UTC (rev 624)
@@ -35,11 +35,12 @@
/** \brief Radio types. */
typedef enum {
- RIG_TYPE_RX = 0, /*!< Rig can only be used as receiver */
- RIG_TYPE_TX, /*!< Rig can only be used as transmitter */
- RIG_TYPE_TRX, /*!< Rig can be used as RX/TX (simplex only) */
- RIG_TYPE_DUPLEX, /*!< Rig is a full duplex radio, e.g. IC910 */
- RIG_TYPE_TOGGLE /*!< Special mode for FT-817, 857 and 897 */
+ RIG_TYPE_RX = 0, /*!< Rig can only be used as receiver */
+ RIG_TYPE_TX, /*!< Rig can only be used as transmitter */
+ RIG_TYPE_TRX, /*!< Rig can be used as RX/TX (simplex only) */
+ RIG_TYPE_DUPLEX, /*!< Rig is a full duplex radio, e.g. IC910 */
+ RIG_TYPE_TOGGLE_AUTO, /*!< Special mode for FT-817, 857 and 897 using auto T/R switch */
+ RIG_TYPE_TOGGLE_MAN /*!< Special mode for FT-817, 857 and 897 using manual T/R switch */
} rig_type_t;
typedef enum {
Modified: trunk/src/sat-pref-rig-editor.c
===================================================================
--- trunk/src/sat-pref-rig-editor.c 2010-07-09 09:31:17 UTC (rev 623)
+++ trunk/src/sat-pref-rig-editor.c 2010-07-09 09:49:40 UTC (rev 624)
@@ -208,7 +208,8 @@
gtk_combo_box_append_text (GTK_COMBO_BOX (type), _("TX only"));
gtk_combo_box_append_text (GTK_COMBO_BOX (type), _("Simplex TRX"));
gtk_combo_box_append_text (GTK_COMBO_BOX (type), _("Duplex TRX"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (type), _("FT817/857/897"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (type), _("FT817/857/897 (auto)"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (type), _("FT817/857/897 (manual)"));
gtk_combo_box_set_active (GTK_COMBO_BOX (type), RIG_TYPE_RX);
g_signal_connect (type, "changed", G_CALLBACK (type_changed), NULL);
gtk_widget_set_tooltip_markup (type,
@@ -227,10 +228,13 @@
"<b>Duplex:</b> The radio is a full duplex radio, such as the IC910H. "\
"Gpredict will be continuously tuning both uplink and downlink "\
"simultaneously and not care about PTT setting.\n\n"\
- "<b>FT817/857/897:</b> This is a special mode that can be used with "\
+ "<b>FT817/857/897 (auto):</b> This is a special mode that can be used with "\
"YAESU FT-817, 857 and 897 radios. These radios do not allow computer "\
"control while in TX mode. Therefore, TX Doppler correction is applied "\
- "while the radio is in RX mode by toggling between VFO A/B."));
+ "while the radio is in RX mode by toggling between VFO A/B.\n\n"\
+ "<b>FT817/857/897 (manual):</b> This is similar to the previous mode except "\
+ "that switching to TX is done by pressing the SPACE key on the keyboard. "\
+ "Gpredict will then update the TX Doppler before actually switching to TX."));
gtk_table_attach_defaults (GTK_TABLE (table), type, 1, 3, 3, 4);
/* ptt */
Modified: trunk/src/sat-pref-rig.c
===================================================================
--- trunk/src/sat-pref-rig.c 2010-07-09 09:31:17 UTC (rev 623)
+++ trunk/src/sat-pref-rig.c 2010-07-09 09:49:40 UTC (rev 624)
@@ -711,29 +711,33 @@
gtk_tree_model_get (model, iter, coli, &type, -1);
switch (type) {
- case RIG_TYPE_RX:
- g_object_set (renderer, "text", _("RX only"), NULL);
- break;
-
- case RIG_TYPE_TX:
- g_object_set (renderer, "text", _("TX only"), NULL);
- break;
+ case RIG_TYPE_RX:
+ g_object_set (renderer, "text", _("RX only"), NULL);
+ break;
- case RIG_TYPE_TRX:
- g_object_set (renderer, "text", _("RX + TX"), NULL);
- break;
+ case RIG_TYPE_TX:
+ g_object_set (renderer, "text", _("TX only"), NULL);
+ break;
- case RIG_TYPE_DUPLEX:
- g_object_set (renderer, "text", _("Duplex"), NULL);
- break;
-
- case RIG_TYPE_TOGGLE:
- g_object_set (renderer, "text", _("FT817/857/897"), NULL);
- break;
+ case RIG_TYPE_TRX:
+ g_object_set (renderer, "text", _("RX + TX"), NULL);
+ break;
- default:
- g_object_set (renderer, "text", _("ERROR"), NULL);
- break;
+ case RIG_TYPE_DUPLEX:
+ g_object_set (renderer, "text", _("Duplex"), NULL);
+ break;
+
+ case RIG_TYPE_TOGGLE_AUTO:
+ g_object_set (renderer, "text", _("FT817/857/897 (auto)"), NULL);
+ break;
+
+ case RIG_TYPE_TOGGLE_MAN:
+ g_object_set (renderer, "text", _("FT817/857/897 (man)"), NULL);
+ break;
+
+ default:
+ g_object_set (renderer, "text", _("ERROR"), NULL);
+ break;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <aa...@us...> - 2010-09-18 01:16:04
|
Revision: 652
http://gpredict.svn.sourceforge.net/gpredict/?rev=652&view=rev
Author: aa1vs
Date: 2010-09-18 01:15:58 +0000 (Sat, 18 Sep 2010)
Log Message:
-----------
Make file name checks check for suffix not substring
Modified Paths:
--------------
trunk/src/first-time.c
trunk/src/gtk-rot-ctrl.c
trunk/src/gtk-sat-selector.c
trunk/src/gtk-sat-tree.c
trunk/src/main.c
trunk/src/mod-cfg.c
trunk/src/sat-log.c
trunk/src/sat-pref-qth.c
trunk/src/tle-update.c
Modified: trunk/src/first-time.c
===================================================================
--- trunk/src/first-time.c 2010-09-17 11:05:26 UTC (rev 651)
+++ trunk/src/first-time.c 2010-09-18 01:15:58 UTC (rev 652)
@@ -201,7 +201,7 @@
so we must not free it
*/
- if (g_strrstr (datafile, ".qth")) {
+ if (g_str_has_suffix (datafile, ".qth")) {
foundqth = TRUE;
}
@@ -227,7 +227,7 @@
/* note: filename is not a newly allocated gchar *,
so we must not free it
*/
- if (g_strrstr (datafile, ".qth")) {
+ if (g_str_has_suffix (datafile, ".qth")) {
gchar *source = g_strconcat (olddir, G_DIR_SEPARATOR_S, datafile, NULL);
@@ -342,7 +342,7 @@
/* note: filename is not a newly allocated gchar *,
so we must not free it
*/
- if (g_strrstr (datafile, ".mod")) {
+ if (g_str_has_suffix (datafile, ".mod")) {
gchar *source = g_strconcat (olddir, G_DIR_SEPARATOR_S, datafile, NULL);
/* copy .qth file to USER_CONF_DIR */
@@ -606,7 +606,7 @@
/* note: filename is not a newly allocated gchar *,
so we must not free it
*/
- if (g_strrstr (filename, ".cat")) {
+ if (g_str_has_suffix (filename, ".cat")) {
/* check whether .cat file exisits in user conf */
gchar *catfilename = sat_file_name (filename);
@@ -852,7 +852,7 @@
/* for each .trsp file found in data dir */
while ((filename = g_dir_read_name (dir))) {
- if (g_strrstr (filename, ".trsp")) {
+ if (g_str_has_suffix (filename, ".trsp")) {
/* check if .trsp file already in user dir */
destfile = g_strconcat (targetdirname, G_DIR_SEPARATOR_S, filename, NULL);
Modified: trunk/src/gtk-rot-ctrl.c
===================================================================
--- trunk/src/gtk-rot-ctrl.c 2010-09-17 11:05:26 UTC (rev 651)
+++ trunk/src/gtk-rot-ctrl.c 2010-09-18 01:15:58 UTC (rev 652)
@@ -501,7 +501,7 @@
/* read each .rot file */
while ((filename = g_dir_read_name (dir))) {
- if (g_strrstr (filename, ".rot")) {
+ if (g_str_has_suffix (filename, ".rot")) {
vbuff = g_strsplit (filename, ".rot", 0);
gtk_combo_box_append_text (GTK_COMBO_BOX (ctrl->DevSel), vbuff[0]);
@@ -1231,7 +1231,7 @@
/* read each .rot file */
while ((filename = g_dir_read_name (dir))) {
- if (g_strrstr (filename, ".rot")) {
+ if (g_str_has_suffix (filename, ".rot")) {
i++;
}
}
Modified: trunk/src/gtk-sat-selector.c
===================================================================
--- trunk/src/gtk-sat-selector.c 2010-09-17 11:05:26 UTC (rev 651)
+++ trunk/src/gtk-sat-selector.c 2010-09-18 01:15:58 UTC (rev 652)
@@ -417,7 +417,7 @@
*/
while ((fname = g_dir_read_name (dir))) {
- if (g_strrstr (fname, ".sat")) {
+ if (g_str_has_suffix (fname, ".sat")) {
buffv = g_strsplit (fname, ".", 0);
catnum = (gint) g_ascii_strtoll (buffv[0], NULL, 0);
@@ -450,7 +450,7 @@
/* load satellites from each .cat file into selector->models[i] */
g_dir_rewind (dir);
while ((fname = g_dir_read_name (dir))) {
- if (g_strrstr (fname, ".cat")) {
+ if (g_str_has_suffix (fname, ".cat")) {
load_cat_file (selector, fname);
Modified: trunk/src/gtk-sat-tree.c
===================================================================
--- trunk/src/gtk-sat-tree.c 2010-09-17 11:05:26 UTC (rev 651)
+++ trunk/src/gtk-sat-tree.c 2010-09-18 01:15:58 UTC (rev 652)
@@ -352,7 +352,7 @@
*/
while ((fname = g_dir_read_name (dir))) {
- if (g_strrstr (fname, ".tle")) {
+ if (g_str_has_suffix (fname, ".tle")) {
buffv = g_strsplit (fname, ".tle", 0);
nodename = g_strdup (buffv[0]);
Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c 2010-09-17 11:05:26 UTC (rev 651)
+++ trunk/src/main.c 2010-09-18 01:15:58 UTC (rev 652)
@@ -608,7 +608,7 @@
while ((filename = g_dir_read_name (targetdir))) {
- if (g_strrstr (filename, ".sat")) {
+ if (g_str_has_suffix (filename, ".sat")) {
/* remove .sat file */
path = sat_file_name (filename);
if G_UNLIKELY(g_unlink (path)) {
@@ -649,7 +649,7 @@
while ((filename = g_dir_read_name (targetdir))) {
- if (g_strrstr (filename, ".trsp")) {
+ if (g_str_has_suffix (filename, ".trsp")) {
/* remove .trsp file */
path = trsp_file_name (filename);
if G_UNLIKELY(g_unlink (path)) {
Modified: trunk/src/mod-cfg.c
===================================================================
--- trunk/src/mod-cfg.c 2010-09-17 11:05:26 UTC (rev 651)
+++ trunk/src/mod-cfg.c 2010-09-18 01:15:58 UTC (rev 652)
@@ -864,7 +864,7 @@
if (dir) {
while ((filename = g_dir_read_name (dir))) {
- if (g_strrstr (filename, ".qth")) {
+ if (g_str_has_suffix (filename, ".qth")) {
buffv = g_strsplit (filename, ".qth", 0);
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), buffv[0]);
Modified: trunk/src/sat-log.c
===================================================================
--- trunk/src/sat-log.c 2010-09-17 11:05:26 UTC (rev 651)
+++ trunk/src/sat-log.c 2010-09-18 01:15:58 UTC (rev 652)
@@ -348,7 +348,7 @@
while ((fname = g_dir_read_name (dir)) != NULL) {
/* ensure this is a .log file */
- if G_LIKELY(g_strrstr (fname, ".log")) {
+ if G_LIKELY(g_str_has_suffix (fname, ".log")) {
vbuf = g_strsplit_set (fname, "-.", -1);
Modified: trunk/src/sat-pref-qth.c
===================================================================
--- trunk/src/sat-pref-qth.c 2010-09-17 11:05:26 UTC (rev 651)
+++ trunk/src/sat-pref-qth.c 2010-09-18 01:15:58 UTC (rev 652)
@@ -312,7 +312,7 @@
while ((filename = g_dir_read_name (dir))) {
- if (g_strrstr (filename, ".qth")) {
+ if (g_str_has_suffix (filename, ".qth")) {
buff = g_strconcat (dirname, G_DIR_SEPARATOR_S,
filename, NULL);
@@ -918,7 +918,7 @@
while ((filename = g_dir_read_name (dir))) {
- if (g_strrstr (filename, ".qth")) {
+ if (g_str_has_suffix (filename, ".qth")) {
buff = g_strconcat (dirname, G_DIR_SEPARATOR_S,
filename, NULL);
Modified: trunk/src/tle-update.c
===================================================================
--- trunk/src/tle-update.c 2010-09-17 11:05:26 UTC (rev 651)
+++ trunk/src/tle-update.c 2010-09-18 01:15:58 UTC (rev 652)
@@ -245,7 +245,7 @@
num = 0;
while ((fnam = g_dir_read_name (loc_dir)) != NULL) {
/* only consider .sat files */
- if (g_strrstr (fnam, ".sat")) {
+ if (g_str_has_suffix (fnam, ".sat")) {
num++;
}
}
@@ -255,7 +255,7 @@
/* update TLE files one by one */
while ((fnam = g_dir_read_name (loc_dir)) != NULL) {
/* only consider .sat files */
- if (g_strrstr (fnam, ".sat")) {
+ if (g_str_has_suffix (fnam, ".sat")) {
/* clear stat bufs */
updated_tmp = 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|