#include <gtk/gtk.h>#include <celengine/render.h>#include <celengine/simulation.h>#include <celestia/celestiacore.h>Include dependency graph for common.h:

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

Go to the source code of this file.
Defines | |
| #define | CELSPACING 8 |
Typedefs | |
| typedef _AppData | AppData |
Functions | |
| gint | buttonMake (GtkWidget *hbox, const char *txt, GtkSignalFunc func, gpointer data) |
| int | getWinHeight (AppData *app) |
| int | getWinWidth (AppData *app) |
| int | getWinX (AppData *app) |
| int | getWinY (AppData *app) |
| void | makeRadioItems (const char *const *labels, GtkWidget *box, GtkSignalFunc sigFunc, GtkToggleButton **gads, gpointer data) |
| char * | readFromFile (const char *fname) |
| void | setDefaultRenderFlags (AppData *app) |
| void | setSaneAltSurface (AppData *app, char *value) |
| void | setSaneAmbientLight (AppData *app, float value) |
| void | setSaneGalaxyLightGain (float value) |
| void | setSaneStarStyle (AppData *app, Renderer::StarStyle value) |
| void | setSaneVerbosity (AppData *app, int value) |
| void | setSaneVisualMagnitude (AppData *app, float value) |
| void | setSaneWinPosition (AppData *app, int x, int y) |
| void | setSaneWinSize (AppData *app, int x, int y) |
| gint | tzOffsetAtDate (astro::Date date) |
| void | updateTimeZone (AppData *app, gboolean local) |
Variables | |
| static const float | amLevels [] |
| const char *const | monthOptions [] |
| static const int | resolutions [] |
|
|
Definition at line 141 of file common.h. Referenced by actionOpenURL(), actionSearchObject(), actionViewerSize(), dialogEclipseFinder(), dialogGotoObject(), dialogSolarBrowser(), dialogStarBrowser(), dialogTourGuide(), and dialogViewOptions(). |
|
|
|
|
||||||||||||||||||||
|
Definition at line 53 of file common.cpp. Referenced by dialogEclipseFinder(), dialogSolarBrowser(), and dialogStarBrowser(). 00054 {
00055 GtkWidget* button = gtk_button_new_with_label(txt);
00056
00057 gtk_box_pack_start(GTK_BOX (hbox), button, TRUE, TRUE, 0);
00058 g_signal_connect(GTK_OBJECT(button), "pressed", func, data);
00059
00060 return 0;
00061 }
|
|
|
Definition at line 126 of file common.cpp. Referenced by confWinHeight(), confWinWidth(), saveSettingsFile(), and saveSettingsGConf(). 00127 {
00128 if (app->fullScreen)
00129 return GPOINTER_TO_INT(g_object_get_data(G_OBJECT(app->mainWindow), "sizeY"));
00130 else
00131 return app->glArea->allocation.height;
00132 }
|
|
|
Definition at line 116 of file common.cpp. Referenced by confWinHeight(), confWinWidth(), saveSettingsFile(), and saveSettingsGConf(). 00117 {
00118 if (app->fullScreen)
00119 return GPOINTER_TO_INT(g_object_get_data(G_OBJECT(app->mainWindow), "sizeX"));
00120 else
00121 return app->glArea->allocation.width;
00122 }
|
|
|
Definition at line 136 of file common.cpp. Referenced by confWinX(), confWinY(), saveSettingsFile(), and saveSettingsGConf(). 00137 {
00138 int positionX;
00139
00140 if (app->fullScreen)
00141 return GPOINTER_TO_INT(g_object_get_data(G_OBJECT(app->mainWindow), "positionX"));
00142 else
00143 {
00144 gtk_window_get_position(GTK_WINDOW(app->mainWindow), &positionX, NULL);
00145 return positionX;
00146 }
00147 }
|
|
|
Definition at line 151 of file common.cpp. Referenced by confWinX(), confWinY(), saveSettingsFile(), and saveSettingsGConf(). 00152 {
00153 int positionY;
00154
00155 if (app->fullScreen)
00156 return GPOINTER_TO_INT(g_object_get_data(G_OBJECT(app->mainWindow), "positionY"));
00157 else
00158 {
00159 gtk_window_get_position(GTK_WINDOW(app->mainWindow), NULL, &positionY);
00160 return positionY;
00161 }
00162 }
|
|
||||||||||||||||||||||||
|
Definition at line 65 of file common.cpp. Referenced by dialogGotoObject(), and dialogStarBrowser(). 00066 {
00067 GSList *group = NULL;
00068
00069 for (gint i=0; labels[i]; i++)
00070 {
00071 GtkWidget *button = gtk_radio_button_new_with_label(group, labels[i]);
00072
00073 if (gads)
00074 gads[i] = GTK_TOGGLE_BUTTON(button);
00075
00076 group = gtk_radio_button_group(GTK_RADIO_BUTTON(button));
00077 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), (i == 0)?1:0);
00078
00079 gtk_box_pack_start(GTK_BOX(box), button, TRUE, TRUE, 0);
00080 gtk_widget_show (button);
00081 g_signal_connect(GTK_OBJECT(button), "pressed", sigFunc, GINT_TO_POINTER(i));
00082
00083 if (data != NULL)
00084 g_object_set_data(G_OBJECT(button), "data", data);
00085 }
00086 }
|
|
|
Definition at line 90 of file common.cpp. Referenced by actionHelpAbout(), and actionHelpControls(). 00091 {
00092 ifstream textFile(fname, ios::in);
00093 string s("");
00094 if (!textFile.is_open())
00095 {
00096 s = "Unable to open file '";
00097 s += fname ;
00098 s += "', probably due to improper installation !\n";
00099 }
00100
00101 char c;
00102 while(textFile.get(c))
00103 {
00104 if (c == '\t')
00105 s += " "; /* 8 spaces */
00106 else if (c == '\014') /* Ctrl+L (form feed) */
00107 s += "\n\n\n\n";
00108 else
00109 s += c;
00110 }
00111 return g_strdup(s.c_str());
00112 }
|
|
|
Definition at line 256 of file common.cpp. Referenced by applySettingsFileMain(). 00257 {
00258 app->renderer->setRenderFlags(Renderer::ShowAtmospheres |
00259 Renderer::ShowAutoMag |
00260 Renderer::ShowStars |
00261 Renderer::ShowPlanets |
00262 Renderer::ShowSmoothLines |
00263 Renderer::ShowCometTails |
00264 Renderer::ShowRingShadows |
00265 Renderer::ShowCloudMaps |
00266 Renderer::ShowRingShadows |
00267 Renderer::ShowEclipseShadows |
00268 Renderer::ShowGalaxies |
00269 Renderer::ShowNebulae |
00270 Renderer::ShowNightMaps);
00271 }
|
|
||||||||||||
|
Definition at line 216 of file common.cpp. Referenced by applySettingsFileMain(), applySettingsGConfMain(), and confAltSurfaceName(). 00217 {
00218 if (value == NULL)
00219 value = (char*)"";
00220
00221 app->simulation->getActiveObserver()->setDisplayedSurface(value);
00222 }
|
|
||||||||||||
|
Definition at line 166 of file common.cpp. Referenced by applySettingsFileMain(), applySettingsGConfMain(), and confAmbientLight(). 00167 {
00168 if (value < 0.0 || value > 1.0)
00169 value = amLevels[1]; /* Default to "Low" */
00170
00171 app->renderer->setAmbientLightLevel(value);
00172 }
|
|
|
Definition at line 186 of file common.cpp. References Galaxy::setLightGain(). Referenced by applySettingsFileMain(), applySettingsGConfMain(), and confGalaxyLightGain(). 00187 {
00188 if (value < 0.0 || value > 1.0)
00189 value = 0.0f; /* Default */
00190
00191 Galaxy::setLightGain(value);
00192 }
|
|
||||||||||||
|
Definition at line 206 of file common.cpp. Referenced by applySettingsFileMain(), applySettingsGConfMain(), and confStarStyle(). 00207 {
00208 if (value < Renderer::FuzzyPointStars || value > Renderer::ScaledDiscStars)
00209 value = Renderer::FuzzyPointStars;
00210
00211 app->renderer->setStarStyle(value);
00212 }
|
|
||||||||||||
|
Definition at line 196 of file common.cpp. Referenced by applySettingsFileMain(), applySettingsGConfMain(), and confVerbosity(). 00197 {
00198 if (value < 0 || value > 2)
00199 value = 1; /* Default to "Terse" */
00200
00201 app->core->setHudDetail(value);
00202 }
|
|
||||||||||||
|
Definition at line 176 of file common.cpp. Referenced by applySettingsFileMain(), applySettingsGConfMain(), and confVisualMagnitude(). 00177 {
00178 if (value < 0.0 || value > 100.0)
00179 value = 8.5f; /* Default from Simulation::Simulation() */
00180
00181 app->simulation->setFaintestVisible(value);
00182 }
|
|
||||||||||||||||
|
Definition at line 242 of file common.cpp. Referenced by applySettingsFilePre(), applySettingsGConfPre(), confWinX(), and confWinY(). 00243 {
00244 int screenX = gdk_screen_get_width(gdk_screen_get_default());
00245 int screenY = gdk_screen_get_height(gdk_screen_get_default());
00246
00247 /* This one is different than the others because we don't have a default */
00248 if (x > 0 && x < screenX && y > 0 && y < screenY)
00249 {
00250 gtk_window_move(GTK_WINDOW(app->mainWindow), x, y);
00251 }
00252 }
|
|
||||||||||||||||
|
Definition at line 226 of file common.cpp. Referenced by applySettingsFilePre(), applySettingsGConfPre(), confWinHeight(), and confWinWidth(). 00227 {
00228 int screenX = gdk_screen_get_width(gdk_screen_get_default());
00229 int screenY = gdk_screen_get_height(gdk_screen_get_default());
00230
00231 if (x < 320 || x > screenX || y < 240 || y > screenY)
00232 {
00233 x = 640;
00234 y = 480;
00235 }
00236
00237 gtk_widget_set_size_request(app->glArea, x, y);
00238 }
|
|
|
Definition at line 26 of file common.cpp. References astro::julianDateToSeconds(). Referenced by dialogSetTime(), and updateTimeZone(). 00027 {
00028 #ifdef WIN32
00029 /* This does not correctly handle DST. Unfortunately, no way to find
00030 * out what UTC offset is at specified date in Windows */
00031 return -timezone;
00032 #else
00033 time_t time = (time_t)astro::julianDateToSeconds(date - astro::Date(1970, 1, 1));
00034 struct tm *d = localtime(&time);
00035
00036 return (gint)d->tm_gmtoff;
00037 #endif
00038 }
|
|
||||||||||||
|
Definition at line 42 of file common.cpp. References tzOffsetAtDate(). Referenced by actionTimeLocal(), confShowLocalTime(), and initRealize(). 00043 {
00044 if (local)
00045 /* Always base current time zone on simulation date */
00046 app->core->setTimeZoneBias(tzOffsetAtDate(app->simulation->getTime()));
00047 else
00048 app->core->setTimeZoneBias(0);
00049 }
|
|
|
Initial value:
{
0.0,
0.1,
0.25
}
|
|
|
Initial value:
{
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December",
NULL
}
Definition at line 103 of file common.h. Referenced by dialogSetTime(), and setButtonDateString(). |
|
|
Initial value:
{
0,
640,
800,
1024,
1152,
1280,
1400,
1600,
-1
}
|
1.4.1