[Gpredict-svn] SF.net SVN: gpredict:[434] trunk
Real time satellite tracking and orbit prediction
Status: Beta
Brought to you by:
csete
|
From: <cs...@us...> - 2009-09-25 13:04:37
|
Revision: 434
http://gpredict.svn.sourceforge.net/gpredict/?rev=434&view=rev
Author: csete
Date: 2009-09-25 13:04:29 +0000 (Fri, 25 Sep 2009)
Log Message:
-----------
Finished implementation of the slider. It allows dragging of the time +/- 5 hours with a resolution of 8 seconds. It is complementary to the spin buttons.
Modified Paths:
--------------
trunk/ChangeLog
trunk/NEWS
trunk/src/gtk-sat-module-tmg.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-09-25 10:47:21 UTC (rev 433)
+++ trunk/ChangeLog 2009-09-25 13:04:29 UTC (rev 434)
@@ -1,11 +1,20 @@
+2009-09-25 Alexandru Csete <oz9aec at gmail.com>
+
+ * src/gtk-sat-module-tmg.c:
+ Finished implementation of the slider. It allows dragging of the time
+ +/- 5 hours with a resolution of 8 seconds. It is complementary to the
+ spin buttons.
+
+
2009-09-24 Alexandru Csete <oz9aec at gmail.com>
* src/gtk-sat-selector.c:
- Fixed a bug that caused tree models to be deleted when selecting a new satellite group.
+ Fixed a bug that caused tree models to be deleted when selecting a new
+ satellite group.
* src/mod-cfg.c:
- Added list of selected satellites and arrow buttons. New satellite selector is now fully
- functional and replaces GtkSatTree.
+ Added list of selected satellites and arrow buttons. New satellite selector
+ is now fully functional and replaces GtkSatTree.
* src/gtk-sat-tree.[ch]:
Removed from build list.
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2009-09-25 10:47:21 UTC (rev 433)
+++ trunk/NEWS 2009-09-25 13:04:29 UTC (rev 434)
@@ -1,15 +1,16 @@
Changes in version 1.1 (TBD)
-- New satellite selector in the module config dialog that makes it easier
- to locate and select satellites.
+- New satellite selector in the module configuration dialog that makes
+ it easier to locate and select satellites.
- User configuration on Unix is now stored in $HOME/.config/Gpredict/
The old configuration is imported automatically and one can still use
Gpredict 1.0 with the old configuration stored in $HOME/.gpredict2/
- Distribution now includes all satellites from CelesTrak.
* Added new Satellite Editor that allows adding/editing/deleting satellite
- data in a convenient UI, includ
+ data in a convenient UI, including...
+- Added a slider control to the Time Controller.
- Fixed bug 2116693: List view does not sort properly for all time formats.
-* Fixed bug 2836265: Time controls should wrap around their limits.
+- Fixed bug 2836265: Time controls should wrap around their limits.
* Binary packages for Windows, Mac OS X, Ubuntu and generic Linux.
Modified: trunk/src/gtk-sat-module-tmg.c
===================================================================
--- trunk/src/gtk-sat-module-tmg.c 2009-09-25 10:47:21 UTC (rev 433)
+++ trunk/src/gtk-sat-module-tmg.c 2009-09-25 13:04:29 UTC (rev 434)
@@ -46,6 +46,7 @@
static void tmg_reset (GtkWidget *widget, gpointer data);
static void tmg_throttle (GtkWidget *widget, gpointer data);
static void tmg_time_set (GtkWidget *widget, gpointer data);
+static void slider_moved (GtkWidget *widget, gpointer data);
static void tmg_hour_wrap (GtkWidget *widget, gpointer data);
static void tmg_min_wrap (GtkWidget *widget, gpointer data);
static void tmg_sec_wrap (GtkWidget *widget, gpointer data);
@@ -264,9 +265,14 @@
2, 3, 4, 5, GTK_SHRINK, GTK_SHRINK, 0, 0);
/* add slider */
- mod->tmgSlider = gtk_hscale_new_with_range (-1.0, +1.0, 0.005);
+ mod->tmgSlider = gtk_hscale_new_with_range (-0.208, +0.208, 0.0001); // +/- 5 hr
+ gtk_widget_set_tooltip_text (mod->tmgSlider,
+ _("Drag the slider to change the time up to +/- 5 hours.\n"\
+ "Resolution is ~ 8 seconds."));
gtk_scale_set_draw_value (GTK_SCALE (mod->tmgSlider), FALSE);
gtk_range_set_value (GTK_RANGE (mod->tmgSlider), 0.0);
+ g_signal_connect (mod->tmgSlider, "value-changed",
+ G_CALLBACK (slider_moved), mod);
/* create the vertical box */
@@ -430,6 +436,9 @@
mod->tmgPdnum = mod->rtPrev;
mod->tmgCdnum = mod->rtNow;
+ /* RESET slider */
+ gtk_range_set_value (GTK_RANGE (mod->tmgSlider), 0.0);
+
/* update widgets; widget signals will have no effect
since the tmgReset flag is TRUE */
tmg_update_widgets (mod);
@@ -471,6 +480,7 @@
guint year, month, day;
gint hr, min, sec, msec;
struct tm tim,utim;
+ gdouble slider;
gdouble jd;
@@ -515,11 +525,36 @@
jd = jd + (gdouble)msec/8.64e+7;
- mod->tmgCdnum = jd;
+ /* get slider offset */
+ slider = gtk_range_get_value (GTK_RANGE (mod->tmgSlider));
+
+ mod->tmgCdnum = jd + slider;
}
}
+/** \brief Signal handler for slider "value-changed" signals
+ * \param widget The widget that was modified.
+ * \param data Pointer to the GtkSatModule structure.
+ *
+ * This function is called when the user moves the slider.
+ * If we are in manual control mode, the function simpley calls
+ * tmg_time_set(). In the other modes, the function switches over
+ * to amnual mode first.
+ */
+static void slider_moved (GtkWidget *widget, gpointer data)
+{
+ GtkSatModule *mod = GTK_SAT_MODULE (data);
+
+ if (mod->throttle) {
+ /* "press" the stop button to trigger a transition into manual mode */
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mod->tmgStop), TRUE);
+ }
+
+ tmg_time_set (widget, data);
+}
+
+
/** \brief Hour controller wrap
* \param widget Pointer to the hour controller widget
* \param data Pointer to the GtkSatModule structure.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|