#include <gtk/gtk.h>#include "common.h"Include dependency graph for dialog-time.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Functions | |
| void | dialogSetTime (AppData *app) |
Variables | |
| static const char * | timeOptions [] = { "UTC", "Local", NULL } |
|
|
Definition at line 36 of file dialog-time.cpp. References chooseOption(), intSpin(), monthChosen(), monthOptions, astro::secondsToJulianDate(), tzOffsetAtDate(), and zoneChosen(). Referenced by actionTimeSet(). 00037 {
00038 int timezone = 1;
00039
00040 GtkWidget *stimedialog = gtk_dialog_new_with_buttons("Set Time",
00041 GTK_WINDOW(app->mainWindow),
00042 GTK_DIALOG_DESTROY_WITH_PARENT,
00043 GTK_STOCK_OK,
00044 GTK_RESPONSE_OK,
00045 "Set Current Time",
00046 GTK_RESPONSE_ACCEPT,
00047 GTK_STOCK_CANCEL,
00048 GTK_RESPONSE_CANCEL,
00049 NULL);
00050
00051 if (app->showLocalTime)
00052 timezone = 2;
00053
00054 GtkWidget *hbox = gtk_hbox_new(FALSE, 6);
00055 GtkWidget *frame = gtk_frame_new("Time");
00056 GtkWidget *align = gtk_alignment_new(0.5, 0.5, 0.0, 0.0);
00057
00058 astro::Date date(app->simulation->getTime() +
00059 astro::secondsToJulianDate(app->core->getTimeZoneBias()));
00060
00061 gtk_widget_show(align);
00062 gtk_widget_show(frame);
00063 gtk_container_add(GTK_CONTAINER(align),GTK_WIDGET(hbox));
00064 gtk_container_add(GTK_CONTAINER(frame),GTK_WIDGET(align));
00065 gtk_container_set_border_width (GTK_CONTAINER (frame), 7);
00066 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(stimedialog)->vbox), frame, FALSE, FALSE, 0);
00067
00068 int seconds = (int)date.seconds;
00069 intSpin(hbox, "Hour", 0, 23, &date.hour, ":");
00070 intSpin(hbox, "Minute", 0, 59, &date.minute, ":");
00071 intSpin(hbox, "Second", 0, 59, &seconds, " ");
00072
00073 chooseOption(hbox,
00074 "Timezone",
00075 (char **)timeOptions,
00076 &timezone,
00077 GTK_SIGNAL_FUNC(zoneChosen));
00078
00079 gtk_widget_show_all(hbox);
00080 hbox = gtk_hbox_new(FALSE, 6);
00081 frame = gtk_frame_new("Date");
00082 align=gtk_alignment_new(0.5, 0.5, 0.0, 0.0);
00083 gtk_container_set_border_width (GTK_CONTAINER (frame), 7);
00084
00085 chooseOption(hbox,
00086 "Month",
00087 (char **)monthOptions,
00088 &date.month,
00089 GTK_SIGNAL_FUNC(monthChosen));
00090
00091 /* (Hopefully, noone will need to go beyond these years :-) */
00092 intSpin(hbox, "Day", 1, 31, &date.day, ",");
00093 intSpin(hbox, "Year", -9999, 9999, &date.year, " ");
00094
00095 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(stimedialog)->vbox), frame, FALSE, FALSE, 0);
00096 gtk_container_add(GTK_CONTAINER(align),GTK_WIDGET(hbox));
00097 gtk_container_add(GTK_CONTAINER(frame),GTK_WIDGET(align));
00098 gtk_widget_show(align);
00099 gtk_widget_show(frame);
00100 gtk_widget_show_all(hbox);
00101
00102 gtk_dialog_set_default_response(GTK_DIALOG(stimedialog), GTK_RESPONSE_OK);
00103 gint button = gtk_dialog_run(GTK_DIALOG(stimedialog));
00104
00105 /* Set the selected seconds value back to the Date struct */
00106 date.seconds = seconds;
00107
00108 if (button == GTK_RESPONSE_ACCEPT)
00109 /* Set current time and exit. */
00110 app->simulation->setTime((double)time(NULL) / 86400.0 + (double)astro::Date(1970, 1, 1));
00111 else if (button == GTK_RESPONSE_OK)
00112 /* Set entered time and exit */
00113 app->simulation->setTime((double)date - ((timezone == 1) ? 0 : astro::secondsToJulianDate(tzOffsetAtDate(date))));
00114
00115 gtk_widget_destroy(stimedialog);
00116 }
|
|
|
Definition at line 26 of file dialog-time.h. |
1.4.1