00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef GTK_COMMON_H
00014 #define GTK_COMMON_H
00015
00016 #ifdef HAVE_CONFIG_H
00017 #include <config.h>
00018 #endif
00019
00020 #include <gtk/gtk.h>
00021
00022 #ifdef GNOME
00023 #include <gconf/gconf-client.h>
00024 #endif
00025
00026 #include <celengine/render.h>
00027 #include <celengine/simulation.h>
00028 #include <celestia/celestiacore.h>
00029
00030
00031 typedef struct _AppData AppData;
00032 struct _AppData {
00033
00034 CelestiaCore* core;
00035 Renderer* renderer;
00036 Simulation* simulation;
00037
00038
00039 GtkWidget* mainWindow;
00040 GtkWidget* mainMenu;
00041 GtkWidget* glArea;
00042 GtkWidget* optionDialog;
00043 GtkWidget* contextMenu;
00044
00045
00046 GtkActionGroup* agMain;
00047 GtkActionGroup* agRender;
00048 GtkActionGroup* agOrbit;
00049 GtkActionGroup* agLabel;
00050 GtkActionGroup* agVerbosity;
00051 GtkActionGroup* agStarStyle;
00052 GtkActionGroup* agAmbient;
00053
00054
00055 #ifdef GNOME
00056 GConfClient* client;
00057 #else
00058 GKeyFile* settingsFile;
00059 #endif
00060
00061
00062 gboolean bReady;
00063
00064
00065 int lastX;
00066 int lastY;
00067
00068
00069 char* startURL;
00070
00071
00072 gboolean showLocalTime;
00073 gboolean fullScreen;
00074 };
00075
00076
00077
00078 gint tzOffsetAtDate(astro::Date date);
00079 void updateTimeZone(AppData* app, gboolean local);
00080 gint buttonMake(GtkWidget *hbox, const char *txt, GtkSignalFunc func, gpointer data);
00081 void makeRadioItems(const char* const *labels, GtkWidget *box, GtkSignalFunc sigFunc, GtkToggleButton **gads, gpointer data);
00082 char* readFromFile(const char *fname);
00083
00084
00085 int getWinWidth(AppData* app);
00086 int getWinHeight(AppData* app);
00087 int getWinX(AppData* app);
00088 int getWinY(AppData* app);
00089
00090
00091 void setSaneAmbientLight(AppData* app, float value);
00092 void setSaneVisualMagnitude(AppData* app, float value);
00093 void setSaneGalaxyLightGain(float value);
00094 void setSaneVerbosity(AppData* app, int value);
00095 void setSaneStarStyle(AppData* app, Renderer::StarStyle value);
00096 void setSaneAltSurface(AppData* app, char* value);
00097 void setSaneWinSize(AppData* app, int x, int y);
00098 void setSaneWinPosition(AppData* app, int x, int y);
00099 void setDefaultRenderFlags(AppData* app);
00100
00101
00102
00103 const char * const monthOptions[] =
00104 {
00105 "January",
00106 "February",
00107 "March",
00108 "April",
00109 "May",
00110 "June",
00111 "July",
00112 "August",
00113 "September",
00114 "October",
00115 "November",
00116 "December",
00117 NULL
00118 };
00119
00120 static const float amLevels[] =
00121 {
00122 0.0,
00123 0.1,
00124 0.25
00125 };
00126
00127 static const int resolutions[] =
00128 {
00129 0,
00130 640,
00131 800,
00132 1024,
00133 1152,
00134 1280,
00135 1400,
00136 1600,
00137 -1
00138 };
00139
00140
00141 #define CELSPACING 8
00142
00143 #endif