Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

common.h

Go to the documentation of this file.
00001 /*
00002  *  Celestia GTK+ Front-End
00003  *  Copyright (C) 2005 Pat Suwalski <pat@suwalski.net>
00004  *
00005  *  This program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2 of the License, or
00008  *  (at your option) any later version.
00009  *
00010  *  $Id: common.h,v 1.3 2005/12/13 06:19:57 suwalski Exp $
00011  */
00012 
00013 #ifndef GTK_COMMON_H
00014 #define GTK_COMMON_H
00015 
00016 #ifdef HAVE_CONFIG_H
00017 #include <config.h>
00018 #endif /* HAVE_CONFIG_H */
00019 
00020 #include <gtk/gtk.h>
00021 
00022 #ifdef GNOME
00023 #include <gconf/gconf-client.h>
00024 #endif /* GNOME */
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         /* Core Pointers */
00034         CelestiaCore* core;
00035         Renderer* renderer;
00036         Simulation* simulation;
00037 
00038         /* Important Widgets */
00039         GtkWidget* mainWindow;
00040         GtkWidget* mainMenu;
00041         GtkWidget* glArea;
00042         GtkWidget* optionDialog;
00043         GtkWidget* contextMenu;
00044         
00045         /* Action Groups */
00046         GtkActionGroup* agMain;
00047         GtkActionGroup* agRender;
00048         GtkActionGroup* agOrbit;
00049         GtkActionGroup* agLabel;
00050         GtkActionGroup* agVerbosity;
00051         GtkActionGroup* agStarStyle;
00052         GtkActionGroup* agAmbient;
00053         
00054         /* Settings */
00055         #ifdef GNOME
00056         GConfClient* client;
00057         #else
00058         GKeyFile* settingsFile;
00059         #endif /* GNOME */
00060         
00061         /* Ready to render? */
00062         gboolean bReady;
00063         
00064         /* Mouse motion tracking */
00065         int lastX;
00066         int lastY;
00067         
00068         /* Starting URL */
00069         char* startURL;
00070         
00071         /* A few preferences not tracked by the core */
00072         gboolean showLocalTime;
00073         gboolean fullScreen;
00074 };
00075 
00076 
00077 /* Helper functions used throughout */
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 /* Functions to get window properties regardless of window state */
00085 int getWinWidth(AppData* app);
00086 int getWinHeight(AppData* app);
00087 int getWinX(AppData* app);
00088 int getWinY(AppData* app);
00089 
00090 /* Functions to apply preferences with sanity checks */
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 /* Constants used throughout */
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,        /* Must start with 0 */
00130         640,
00131         800,
00132         1024,
00133         1152,
00134         1280,
00135         1400,
00136         1600,
00137         -1        /* Must end with -1 */
00138 };
00139 
00140 /* This is the spacing used for widgets throughout the program */
00141 #define CELSPACING 8
00142 
00143 #endif /* GTK_COMMON_H */

Generated on Sat Jan 14 22:30:30 2006 for Celestia by  doxygen 1.4.1