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

actions.cpp File Reference

#include <cstring>
#include <fstream>
#include <gtk/gtk.h>
#include <celengine/body.h>
#include <celengine/gl.h>
#include <celengine/glext.h>
#include <celengine/simulation.h>
#include <celengine/cmdparser.h>
#include <celengine/render.h>
#include <celestia/celestiacore.h>
#include <celestia/imagecapture.h>
#include <celestia/url.h>
#include <celutil/filetype.h>
#include "actions.h"
#include "common.h"
#include "dialog-eclipse.h"
#include "dialog-goto.h"
#include "dialog-options.h"
#include "dialog-solar.h"
#include "dialog-star.h"
#include "dialog-time.h"
#include "dialog-tour.h"
#include "settings-file.h"

Include dependency graph for actions.cpp:

Go to the source code of this file.

Functions

void actionAmbientLight (GtkRadioAction *action, GtkRadioAction *, AppData *app)
void actionCaptureImage (GtkAction *, AppData *app)
void actionCenterSelection (GtkAction *, AppData *app)
void actionCopyURL (GtkAction *, AppData *app)
void actionEclipseFinder (GtkAction *, AppData *app)
void actionFollowSelection (GtkAction *, AppData *app)
void actionFullScreen (GtkAction *action, AppData *app)
void actionGotoObject (GtkAction *, AppData *app)
void actionGotoSelection (GtkAction *, AppData *app)
void actionHelpAbout (GtkAction *, AppData *app)
void actionHelpControls (GtkAction *, AppData *app)
void actionHelpOpenGL (GtkAction *, AppData *app)
void actionLabelAsteroids (GtkToggleAction *action, AppData *app)
void actionLabelComets (GtkToggleAction *action, AppData *app)
void actionLabelConstellations (GtkToggleAction *action, AppData *app)
void actionLabelGalaxies (GtkToggleAction *action, AppData *app)
void actionLabelLocations (GtkToggleAction *action, AppData *app)
void actionLabelMoons (GtkToggleAction *action, AppData *app)
void actionLabelNebulae (GtkToggleAction *action, AppData *app)
void actionLabelOpenClusters (GtkToggleAction *action, AppData *app)
void actionLabelPlanets (GtkToggleAction *action, AppData *app)
void actionLabelSpacecraft (GtkToggleAction *action, AppData *app)
void actionLabelStars (GtkToggleAction *action, AppData *app)
void actionMenuBarVisible (GtkToggleAction *action, AppData *app)
void actionMultiCycle (GtkAction *, AppData *app)
void actionMultiDelete (GtkAction *, AppData *app)
void actionMultiShowActive (GtkToggleAction *action, AppData *app)
void actionMultiShowFrames (GtkToggleAction *action, AppData *app)
void actionMultiSingle (GtkAction *, AppData *app)
void actionMultiSplitH (GtkAction *, AppData *app)
void actionMultiSplitV (GtkAction *, AppData *app)
void actionMultiSyncTime (GtkToggleAction *action, AppData *app)
void actionOpenScript (GtkAction *, AppData *app)
void actionOpenURL (GtkAction *, AppData *app)
void actionOrbitAsteroids (GtkToggleAction *action, AppData *app)
void actionOrbitComets (GtkToggleAction *action, AppData *app)
void actionOrbitMoons (GtkToggleAction *action, AppData *app)
void actionOrbitPlanets (GtkToggleAction *action, AppData *app)
void actionOrbitSpacecraft (GtkToggleAction *action, AppData *app)
void actionQuit (GtkAction *, AppData *app)
void actionRenderAA (GtkToggleAction *action, AppData *app)
void actionRenderAtmospheres (GtkToggleAction *action, AppData *app)
void actionRenderAutoMagnitude (GtkToggleAction *action, AppData *app)
void actionRenderCelestialGrid (GtkToggleAction *action, AppData *app)
void actionRenderClouds (GtkToggleAction *action, AppData *app)
void actionRenderCometTails (GtkToggleAction *action, AppData *app)
void actionRenderConstellationBoundaries (GtkToggleAction *action, AppData *app)
void actionRenderConstellations (GtkToggleAction *action, AppData *app)
void actionRenderEclipseShadows (GtkToggleAction *action, AppData *app)
void actionRenderGalaxies (GtkToggleAction *action, AppData *app)
void actionRenderMarkers (GtkToggleAction *action, AppData *app)
void actionRenderNebulae (GtkToggleAction *action, AppData *app)
void actionRenderNightLights (GtkToggleAction *action, AppData *app)
void actionRenderOpenClusters (GtkToggleAction *action, AppData *app)
void actionRenderOrbits (GtkToggleAction *action, AppData *app)
void actionRenderPlanets (GtkToggleAction *action, AppData *app)
void actionRenderRingShadows (GtkToggleAction *action, AppData *app)
void actionRenderStars (GtkToggleAction *action, AppData *app)
void actionRunDemo (GtkAction *, AppData *app)
void actionSearchObject (GtkAction *, AppData *app)
void actionSelectSol (GtkAction *, AppData *app)
void actionStarBrowser (GtkAction *, AppData *app)
void actionStarsFewer (GtkAction *, AppData *app)
void actionStarsMore (GtkAction *, AppData *app)
void actionStarStyle (GtkRadioAction *action, GtkRadioAction *, AppData *app)
void actionSyncSelection (GtkAction *, AppData *app)
void actionSystemBrowser (GtkAction *, AppData *app)
void actionTimeFaster (GtkAction *, AppData *app)
void actionTimeFreeze (GtkAction *, AppData *app)
void actionTimeLocal (GtkAction *action, AppData *app)
void actionTimeReal (GtkAction *, AppData *app)
void actionTimeReverse (GtkAction *, AppData *app)
void actionTimeSet (GtkAction *, AppData *app)
void actionTimeSlower (GtkAction *, AppData *app)
void actionTourGuide (GtkAction *, AppData *app)
void actionTrackSelection (GtkAction *, AppData *app)
void actionVerbosity (GtkRadioAction *action, GtkRadioAction *, AppData *app)
void actionViewerSize (GtkAction *, AppData *app)
void actionViewOptions (GtkAction *, AppData *app)
static void captureImage (const char *filename, AppData *app)
static void openScript (const char *filename, AppData *app)
void resyncAmbientActions (AppData *app)
void resyncGalaxyGainActions (AppData *app)
void resyncLabelActions (AppData *app)
void resyncOrbitActions (AppData *app)
void resyncRenderActions (AppData *app)
void resyncStarStyleActions (AppData *app)
void resyncTimeZoneAction (AppData *app)
void resyncVerbosityActions (AppData *app)
static void setLabelMode (AppData *a, int mode, gboolean state)
static void setOrbitMask (AppData *a, int mask, gboolean state)
static void setRenderFlag (AppData *a, int flag, gboolean state)
static void textInfoDialog (const char *txt, const char *title, AppData *app)


Function Documentation

void actionAmbientLight GtkRadioAction *  action,
GtkRadioAction *  ,
AppData app
 

Definition at line 644 of file actions.cpp.

Referenced by createMainMenu().

00645 {
00646         float value = amLevels[gtk_radio_action_get_current_value(action)];
00647         app->renderer->setAmbientLightLevel(value);
00648 
00649         #ifdef GNOME
00650         gconf_client_set_float(app->client, "/apps/celestia/ambientLight", value, NULL);
00651         #endif
00652 }

void actionCaptureImage GtkAction *  ,
AppData app
 

Definition at line 139 of file actions.cpp.

References captureImage().

Referenced by handleSpecialKey().

00140 {
00141         GtkWidget* fs = gtk_file_chooser_dialog_new("Save Image to File",
00142                                                     GTK_WINDOW(app->mainWindow),
00143                                                     GTK_FILE_CHOOSER_ACTION_SAVE,
00144                                                     GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
00145                                                     GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
00146                                                     NULL);
00147 
00148         GtkFileFilter* filter = gtk_file_filter_new();
00149         gtk_file_filter_set_name(filter, "PNG and JPEG Images");
00150         gtk_file_filter_add_pattern(filter, "*.jpeg");
00151         gtk_file_filter_add_pattern(filter, "*.jpg");
00152         gtk_file_filter_add_pattern(filter, "*.png");
00153         gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(fs), filter);
00154 
00155         #if GTK_CHECK_VERSION(2, 7, 0)
00156         gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(fs), TRUE);
00157         #endif /* GTK_CHECK_VERSION */
00158         
00159         gtk_dialog_set_default_response(GTK_DIALOG(fs), GTK_RESPONSE_ACCEPT);
00160         gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(fs), g_get_home_dir());
00161 
00162         if (gtk_dialog_run(GTK_DIALOG(fs)) == GTK_RESPONSE_ACCEPT)
00163         {
00164                 char* filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fs));
00165                 captureImage(filename, app);
00166                 g_free(filename);
00167         }
00168 
00169         gtk_widget_destroy(fs);
00170 }

void actionCenterSelection GtkAction *  ,
AppData app
 

Definition at line 240 of file actions.cpp.

Referenced by dialogSolarBrowser(), and dialogStarBrowser().

00241 {
00242         app->core->charEntered('c');
00243 }

void actionCopyURL GtkAction *  ,
AppData app
 

Definition at line 63 of file actions.cpp.

00064 {
00065         GtkClipboard* cb = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
00066         Url url(app->core);
00067         gtk_clipboard_set_text(cb, url.getAsString().c_str(), -1);
00068 }

void actionEclipseFinder GtkAction *  ,
AppData app
 

Definition at line 282 of file actions.cpp.

References dialogEclipseFinder().

00283 {
00284         dialogEclipseFinder(app);
00285 }

void actionFollowSelection GtkAction *  ,
AppData app
 

Definition at line 252 of file actions.cpp.

00253 {
00254         app->core->charEntered('F');
00255 }

void actionFullScreen GtkAction *  action,
AppData app
 

Definition at line 408 of file actions.cpp.

00409 {
00410         int positionX, positionY;
00411         app->fullScreen = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
00412         
00413         if (app->fullScreen)
00414         {
00415                 /* Save size/position, so original numbers are available for prefs */
00416                 g_object_set_data(G_OBJECT(app->mainWindow), "sizeX", GINT_TO_POINTER(app->glArea->allocation.width));
00417                 g_object_set_data(G_OBJECT(app->mainWindow), "sizeY", GINT_TO_POINTER(app->glArea->allocation.height));
00418                 gtk_window_get_position(GTK_WINDOW(app->mainWindow), &positionX, &positionY);
00419                 g_object_set_data(G_OBJECT(app->mainWindow), "positionX", GINT_TO_POINTER(positionX));
00420                 g_object_set_data(G_OBJECT(app->mainWindow), "positionY", GINT_TO_POINTER(positionY));
00421 
00422                 gtk_window_fullscreen(GTK_WINDOW(app->mainWindow));
00423         }
00424         else
00425                 gtk_window_unfullscreen(GTK_WINDOW(app->mainWindow));
00426 
00427         /* Enable/Disable the Viewer Size action */
00428         gtk_action_set_sensitive(gtk_action_group_get_action(app->agMain, "ViewerSize"), !app->fullScreen);
00429         
00430         #ifdef GNOME
00431         gconf_client_set_bool(app->client, "/apps/celestia/fullScreen", app->fullScreen, NULL);
00432         #endif
00433 }

void actionGotoObject GtkAction *  ,
AppData app
 

Definition at line 234 of file actions.cpp.

References dialogGotoObject().

00235 {
00236         dialogGotoObject(app);
00237 }

void actionGotoSelection GtkAction *  ,
AppData app
 

Definition at line 246 of file actions.cpp.

Referenced by dialogSolarBrowser(), and dialogStarBrowser().

00247 {
00248         app->core->charEntered('G');
00249 }

void actionHelpAbout GtkAction *  ,
AppData app
 

Definition at line 584 of file actions.cpp.

References FRONTEND, and readFromFile().

00585 {
00586         const gchar* authors[] = {
00587                 "Active Developers ***\n",
00588                 "Grant Hutchison <grantcelestia@xemaps.com>\n"
00589                         "\tAstronomical Research\n",
00590                 "Da-Woon Jung <dirkpitt2050@gmail.com>\n"
00591                         "\tMacOSX Front-End\n",
00592                 "Chris Laurel <claurel@shatters.net>\n"
00593                         "\tOpenGL Engine, Windows Front-End\n",
00594                 "Fridger Schrempp <fridger.schrempp@desy.de>\n"
00595                         "\tResearch, Engine, GTK+ 1 Front-End\n",
00596                 "Pat Suwalski <pat@suwalski.net>\n"
00597                         "\tGTK+ 2 Front-End\n",
00598                 "Christophe Teyssier <chris@teyssier.org>\n"
00599                         "\tKDE Front-End, Browser Integration\n",
00600                 "\nPast Developers ***\n",
00601                 "Bob Ippolito <bob@redivi.com>",
00602                 "Deon Ramsey <dramsey@sourceforge.net>",
00603                 "Clint Weisbrod <cweisbrod@cogeco.ca>",
00604                 NULL
00605     };
00606 
00607         GdkPixbuf *logo = gdk_pixbuf_new_from_file ("celestia-logo.png", NULL);
00608         
00609         gtk_show_about_dialog(GTK_WINDOW(app->mainWindow),
00610                              "name", "Celestia",
00611                              "version", VERSION,
00612                              "copyright", "Copyright \xc2\xa9 2001-2005 Chris Laurel",
00613                              "comments", FRONTEND " Front-End",
00614                              "website", "http://celestia.sf.net",
00615                              "authors", authors,
00616                              "license", readFromFile("COPYING"),
00617                              "logo", logo,
00618                              NULL);
00619 }

void actionHelpControls GtkAction *  ,
AppData app
 

Definition at line 523 of file actions.cpp.

References readFromFile(), and textInfoDialog().

00524 {
00525         char *txt = readFromFile("controls.txt");
00526         textInfoDialog(txt, "Mouse and Keyboard Controls", app);
00527         g_free(txt);
00528 }

void actionHelpOpenGL GtkAction *  ,
AppData app
 

Definition at line 531 of file actions.cpp.

References ExtensionSupported(), GL_MAX_TEXTURE_UNITS_ARB, and textInfoDialog().

00532 {
00533         /* Code grabbed from winmain.cpp */
00534         char* vendor = (char*) glGetString(GL_VENDOR);
00535         char* render = (char*) glGetString(GL_RENDERER);
00536         char* version = (char*) glGetString(GL_VERSION);
00537         char* ext = (char*) glGetString(GL_EXTENSIONS);
00538         
00539         string s;
00540         s = "Vendor: ";
00541         if (vendor != NULL)
00542                 s += vendor;
00543         s += "\n";
00544 
00545         s += "Renderer: ";
00546         if (render != NULL)
00547                 s += render;
00548         s += "\n";
00549 
00550         s += "Version: ";
00551         if (version != NULL)
00552                 s += version;
00553         s += "\n";
00554 
00555         char buf[100];
00556         GLint simTextures = 1;
00557         if (ExtensionSupported("GL_ARB_multitexture"))
00558                 glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &simTextures);
00559         sprintf(buf, "Max simultaneous textures: %d\n", simTextures);
00560         s += buf;
00561 
00562         GLint maxTextureSize = 0;
00563         glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
00564         sprintf(buf, "Max texture size: %d\n\n", maxTextureSize);
00565         s += buf;
00566 
00567         s += "Supported Extensions:\n    ";
00568         if (ext != NULL)
00569         {
00570                 string extString(ext);
00571                 unsigned int pos = extString.find(' ', 0);
00572                 while (pos != (unsigned int)string::npos)
00573                 {
00574                         extString.replace(pos, 1, "\n    ");
00575                         pos = extString.find(' ', pos + 5);
00576                 }
00577                 s += extString;
00578         }
00579 
00580         textInfoDialog(s.c_str(), "Open GL Info", app);
00581 }

void actionLabelAsteroids GtkToggleAction *  action,
AppData app
 

Definition at line 793 of file actions.cpp.

References setLabelMode().

00794 {
00795         setLabelMode(app, Renderer::AsteroidLabels, gtk_toggle_action_get_active(action));
00796 }

void actionLabelComets GtkToggleAction *  action,
AppData app
 

Definition at line 799 of file actions.cpp.

References setLabelMode().

00800 {
00801         setLabelMode(app, Renderer::CometLabels, gtk_toggle_action_get_active(action));
00802 }

void actionLabelConstellations GtkToggleAction *  action,
AppData app
 

Definition at line 805 of file actions.cpp.

References setLabelMode().

00806 {
00807         setLabelMode(app, Renderer::ConstellationLabels, gtk_toggle_action_get_active(action));
00808 }

void actionLabelGalaxies GtkToggleAction *  action,
AppData app
 

Definition at line 811 of file actions.cpp.

References setLabelMode().

00812 {
00813         setLabelMode(app, Renderer::GalaxyLabels, gtk_toggle_action_get_active(action));
00814 }

void actionLabelLocations GtkToggleAction *  action,
AppData app
 

Definition at line 817 of file actions.cpp.

References setLabelMode().

00818 {
00819         setLabelMode(app, Renderer::LocationLabels, gtk_toggle_action_get_active(action));
00820 }

void actionLabelMoons GtkToggleAction *  action,
AppData app
 

Definition at line 823 of file actions.cpp.

References setLabelMode().

00824 {
00825         setLabelMode(app, Renderer::MoonLabels, gtk_toggle_action_get_active(action));
00826 }

void actionLabelNebulae GtkToggleAction *  action,
AppData app
 

Definition at line 829 of file actions.cpp.

References setLabelMode().

00830 {
00831         setLabelMode(app, Renderer::NebulaLabels, gtk_toggle_action_get_active(action));
00832 }

void actionLabelOpenClusters GtkToggleAction *  action,
AppData app
 

Definition at line 835 of file actions.cpp.

References setLabelMode().

00836 {
00837         setLabelMode(app, Renderer::OpenClusterLabels, gtk_toggle_action_get_active(action));
00838 }

void actionLabelPlanets GtkToggleAction *  action,
AppData app
 

Definition at line 841 of file actions.cpp.

References setLabelMode().

00842 {
00843         setLabelMode(app, Renderer::PlanetLabels, gtk_toggle_action_get_active(action));
00844 }

void actionLabelSpacecraft GtkToggleAction *  action,
AppData app
 

Definition at line 847 of file actions.cpp.

References setLabelMode().

00848 {
00849         setLabelMode(app, Renderer::SpacecraftLabels, gtk_toggle_action_get_active(action));
00850 }

void actionLabelStars GtkToggleAction *  action,
AppData app
 

Definition at line 853 of file actions.cpp.

References setLabelMode().

00854 {
00855         setLabelMode(app, Renderer::StarLabels, gtk_toggle_action_get_active(action));
00856 }

void actionMenuBarVisible GtkToggleAction *  action,
AppData app
 

Definition at line 462 of file actions.cpp.

00463 {
00464         g_object_set(G_OBJECT(app->mainMenu), "visible", gtk_toggle_action_get_active(action), NULL);
00465 }

void actionMultiCycle GtkAction *  ,
AppData app
 

Definition at line 480 of file actions.cpp.

00481 {
00482         /* Pass a Tab character */
00483         app->core->charEntered('\011');
00484 }

void actionMultiDelete GtkAction *  ,
AppData app
 

Definition at line 487 of file actions.cpp.

00488 {
00489         app->core->deleteView();
00490 }

void actionMultiShowActive GtkToggleAction *  action,
AppData app
 

Definition at line 505 of file actions.cpp.

00506 {
00507         app->core->setActiveFrameVisible(gtk_toggle_action_get_active(action));
00508 }

void actionMultiShowFrames GtkToggleAction *  action,
AppData app
 

Definition at line 499 of file actions.cpp.

00500 {
00501         app->core->setFramesVisible(gtk_toggle_action_get_active(action));
00502 }

void actionMultiSingle GtkAction *  ,
AppData app
 

Definition at line 493 of file actions.cpp.

00494 {
00495         app->core->singleView();
00496 }

void actionMultiSplitH GtkAction *  ,
AppData app
 

Definition at line 468 of file actions.cpp.

00469 {
00470         app->core->splitView(View::HorizontalSplit);
00471 }

void actionMultiSplitV GtkAction *  ,
AppData app
 

Definition at line 474 of file actions.cpp.

00475 {
00476         app->core->splitView(View::VerticalSplit);
00477 }

void actionMultiSyncTime GtkToggleAction *  action,
AppData app
 

Definition at line 511 of file actions.cpp.

00512 {
00513         app->simulation->setSyncTime(gtk_toggle_action_get_active(action));
00514 }

void actionOpenScript GtkAction *  ,
AppData app
 

Definition at line 99 of file actions.cpp.

References openScript().

00100 {
00101         GtkWidget* fs = gtk_file_chooser_dialog_new("Open Script.",
00102                                                     GTK_WINDOW(app->mainWindow),
00103                                                     GTK_FILE_CHOOSER_ACTION_OPEN,
00104                                                     GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
00105                                                     GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
00106                                                     NULL);
00107 
00108         #if GTK_CHECK_VERSION(2, 7, 0)
00109         gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(fs), TRUE);
00110         #endif /* GTK_CHECK_VERSION */
00111 
00112         gtk_dialog_set_default_response(GTK_DIALOG(fs), GTK_RESPONSE_ACCEPT);
00113         gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(fs), g_get_home_dir());
00114 
00115         GtkFileFilter* filter = gtk_file_filter_new();
00116         gtk_file_filter_set_name(filter, "Celestia Scripts");
00117         
00118         gtk_file_filter_add_pattern(filter, "*.cel");
00119 
00120         #ifdef CELX
00121         gtk_file_filter_add_pattern(filter, "*.celx");
00122         gtk_file_filter_add_pattern(filter, "*.clx");
00123         #endif /* CELX */
00124         
00125         gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(fs), filter);
00126         
00127         if (gtk_dialog_run(GTK_DIALOG(fs)) == GTK_RESPONSE_ACCEPT)
00128         {
00129                 char* filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fs));
00130                 openScript(filename, app);
00131                 g_free(filename);
00132         }
00133 
00134         gtk_widget_destroy(fs); 
00135 }

void actionOpenURL GtkAction *  ,
AppData app
 

Definition at line 72 of file actions.cpp.

References CELSPACING.

00073 {
00074         GtkWidget* dialog = gtk_dialog_new_with_buttons("Enter cel:// URL",
00075                                                         GTK_WINDOW(app->mainWindow),
00076                                                         GTK_DIALOG_MODAL,
00077                                                         GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
00078                                                         GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
00079                                                         NULL);
00080 
00081         /* Create a new entry box with default text, all selected */
00082         GtkWidget* entry = gtk_entry_new();
00083         gtk_entry_set_width_chars(GTK_ENTRY(entry), 80);
00084         gtk_entry_set_text(GTK_ENTRY(entry), "cel://");
00085         gtk_editable_select_region(GTK_EDITABLE(entry), 0, -1);
00086 
00087         gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), entry, TRUE, TRUE, CELSPACING);
00088         gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
00089         gtk_widget_show_all(dialog);
00090 
00091         if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
00092                 app->core->goToUrl(gtk_entry_get_text(GTK_ENTRY(entry)));
00093 
00094         gtk_widget_destroy(dialog);
00095 }

void actionOrbitAsteroids GtkToggleAction *  action,
AppData app
 

Definition at line 763 of file actions.cpp.

References setOrbitMask().

00764 {
00765         setOrbitMask(app, Body::Asteroid, gtk_toggle_action_get_active(action));
00766 }

void actionOrbitComets GtkToggleAction *  action,
AppData app
 

Definition at line 769 of file actions.cpp.

References setOrbitMask().

00770 {
00771         setOrbitMask(app, Body::Comet, gtk_toggle_action_get_active(action));
00772 }

void actionOrbitMoons GtkToggleAction *  action,
AppData app
 

Definition at line 775 of file actions.cpp.

References setOrbitMask().

00776 {
00777         setOrbitMask(app, Body::Moon, gtk_toggle_action_get_active(action));
00778 }

void actionOrbitPlanets GtkToggleAction *  action,
AppData app
 

Definition at line 781 of file actions.cpp.

References setOrbitMask().

00782 {
00783         setOrbitMask(app, Body::Planet, gtk_toggle_action_get_active(action));
00784 }

void actionOrbitSpacecraft GtkToggleAction *  action,
AppData app
 

Definition at line 787 of file actions.cpp.

References setOrbitMask().

00788 {
00789         setOrbitMask(app, Body::Spacecraft, gtk_toggle_action_get_active(action));
00790 }

void actionQuit GtkAction *  ,
AppData app
 

Definition at line 173 of file actions.cpp.

References saveSettingsFile(), and saveSettingsGConf().

Referenced by main().

00174 {
00175         #ifdef GNOME
00176         saveSettingsGConf(app);
00177         #else
00178         saveSettingsFile(app);
00179         #endif /* GNOME */
00180 
00181         gtk_main_quit();
00182 }

void actionRenderAA GtkToggleAction *  action,
AppData app
 

Definition at line 655 of file actions.cpp.

References setRenderFlag().

00656 {
00657         setRenderFlag(app, Renderer::ShowSmoothLines, gtk_toggle_action_get_active(action));
00658 }

void actionRenderAtmospheres GtkToggleAction *  action,
AppData app
 

Definition at line 661 of file actions.cpp.

References setRenderFlag().

00662 {
00663         setRenderFlag(app, Renderer::ShowAtmospheres, gtk_toggle_action_get_active(action));
00664 }

void actionRenderAutoMagnitude GtkToggleAction *  action,
AppData app
 

Definition at line 667 of file actions.cpp.

References setRenderFlag().

00668 {
00669         setRenderFlag(app, Renderer::ShowAutoMag, gtk_toggle_action_get_active(action));
00670 }

void actionRenderCelestialGrid GtkToggleAction *  action,
AppData app
 

Definition at line 673 of file actions.cpp.

References setRenderFlag().

00674 {
00675         setRenderFlag(app, Renderer::ShowCelestialSphere, gtk_toggle_action_get_active(action));
00676 }

void actionRenderClouds GtkToggleAction *  action,
AppData app
 

Definition at line 679 of file actions.cpp.

References setRenderFlag().

00680 {
00681         setRenderFlag(app, Renderer::ShowCloudMaps, gtk_toggle_action_get_active(action));
00682 }

void actionRenderCometTails GtkToggleAction *  action,
AppData app
 

Definition at line 685 of file actions.cpp.

References setRenderFlag().

00686 {
00687         setRenderFlag(app, Renderer::ShowCometTails, gtk_toggle_action_get_active(action));
00688 }

void actionRenderConstellationBoundaries GtkToggleAction *  action,
AppData app
 

Definition at line 691 of file actions.cpp.

References setRenderFlag().

00692 {
00693         setRenderFlag(app, Renderer::ShowBoundaries, gtk_toggle_action_get_active(action));
00694 }

void actionRenderConstellations GtkToggleAction *  action,
AppData app
 

Definition at line 697 of file actions.cpp.

References setRenderFlag().

00698 {
00699         setRenderFlag(app, Renderer::ShowDiagrams, gtk_toggle_action_get_active(action));
00700 }

void actionRenderEclipseShadows GtkToggleAction *  action,
AppData app
 

Definition at line 703 of file actions.cpp.

References setRenderFlag().

00704 {
00705         setRenderFlag(app, Renderer::ShowEclipseShadows, gtk_toggle_action_get_active(action));
00706 }

void actionRenderGalaxies GtkToggleAction *  action,
AppData app
 

Definition at line 709 of file actions.cpp.

References setRenderFlag().

00710 {
00711         setRenderFlag(app, Renderer::ShowGalaxies, gtk_toggle_action_get_active(action));
00712 }

void actionRenderMarkers GtkToggleAction *  action,
AppData app
 

Definition at line 715 of file actions.cpp.

References setRenderFlag().

00716 {
00717         setRenderFlag(app, Renderer::ShowMarkers, gtk_toggle_action_get_active(action));
00718 }

void actionRenderNebulae GtkToggleAction *  action,
AppData app
 

Definition at line 721 of file actions.cpp.

References setRenderFlag().

00722 {
00723         setRenderFlag(app, Renderer::ShowNebulae, gtk_toggle_action_get_active(action));
00724 }

void actionRenderNightLights GtkToggleAction *  action,
AppData app
 

Definition at line 727 of file actions.cpp.

References setRenderFlag().

00728 {
00729         setRenderFlag(app, Renderer::ShowNightMaps, gtk_toggle_action_get_active(action));
00730 }

void actionRenderOpenClusters GtkToggleAction *  action,
AppData app
 

Definition at line 733 of file actions.cpp.

References setRenderFlag().

00734 {
00735         setRenderFlag(app, Renderer::ShowOpenClusters, gtk_toggle_action_get_active(action));
00736 }

void actionRenderOrbits GtkToggleAction *  action,
AppData app
 

Definition at line 739 of file actions.cpp.

References setRenderFlag().

00740 {
00741         setRenderFlag(app, Renderer::ShowOrbits, gtk_toggle_action_get_active(action));
00742 }

void actionRenderPlanets GtkToggleAction *  action,
AppData app
 

Definition at line 745 of file actions.cpp.

References setRenderFlag().

00746 {
00747         setRenderFlag(app, Renderer::ShowPlanets, gtk_toggle_action_get_active(action));
00748 }

void actionRenderRingShadows GtkToggleAction *  action,
AppData app
 

Definition at line 751 of file actions.cpp.

References setRenderFlag().

00752 {
00753         setRenderFlag(app, Renderer::ShowRingShadows, gtk_toggle_action_get_active(action));
00754 }

void actionRenderStars GtkToggleAction *  action,
AppData app
 

Definition at line 757 of file actions.cpp.

References setRenderFlag().

00758 {
00759         setRenderFlag(app, Renderer::ShowStars, gtk_toggle_action_get_active(action));
00760 }

void actionRunDemo GtkAction *  ,
AppData app
 

Definition at line 517 of file actions.cpp.

00518 {
00519         app->core->charEntered('D');
00520 }

void actionSearchObject GtkAction *  ,
AppData app
 

Definition at line 197 of file actions.cpp.

References CELSPACING, and Selection::empty().

00198 {
00199         GtkWidget* dialog = gtk_dialog_new_with_buttons("Select Object",
00200                                                         GTK_WINDOW(app->mainWindow),
00201                                                         GTK_DIALOG_DESTROY_WITH_PARENT,
00202                                                         GTK_STOCK_OK, GTK_RESPONSE_OK,
00203                                                         GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
00204                                                         NULL);
00205 
00206         GtkWidget* box = gtk_hbox_new(FALSE, CELSPACING);
00207         gtk_container_set_border_width(GTK_CONTAINER(box), CELSPACING);
00208         gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), box, TRUE, TRUE, 0);
00209 
00210         GtkWidget* label = gtk_label_new("Object name");
00211         gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 0);
00212 
00213         GtkWidget* entry = gtk_entry_new();
00214         gtk_box_pack_start(GTK_BOX(box), entry, TRUE, TRUE, 0);
00215 
00216         gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK);
00217         gtk_widget_show_all(GTK_WIDGET(dialog));
00218 
00219         if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK)
00220         {
00221                 const gchar* name = gtk_entry_get_text(GTK_ENTRY(entry));
00222                 if (name != NULL)
00223                 {
00224                         Selection sel = app->simulation->findObject(name);
00225                         if (!sel.empty())
00226                                 app->simulation->setSelection(sel);
00227                 }
00228         }
00229 
00230         gtk_widget_destroy(GTK_WIDGET(dialog));
00231 }

void actionSelectSol GtkAction *  ,
AppData app
 

Definition at line 185 of file actions.cpp.

00186 {
00187         app->core->charEntered('H');
00188 }

void actionStarBrowser GtkAction *  ,
AppData app
 

Definition at line 276 of file actions.cpp.

References dialogStarBrowser().

00277 {
00278         dialogStarBrowser(app);
00279 }

void actionStarsFewer GtkAction *  ,
AppData app
 

Definition at line 452 of file actions.cpp.

00453 {
00454         app->core->charEntered('[');
00455 
00456         #ifdef GNOME
00457         gconf_client_set_float(app->client, "/apps/celestia/visualMagnitude", app->simulation->getFaintestVisible(), NULL);
00458         #endif
00459 }

void actionStarsMore GtkAction *  ,
AppData app
 

Definition at line 442 of file actions.cpp.

00443 {
00444         app->core->charEntered(']');    
00445 
00446         #ifdef GNOME
00447         gconf_client_set_float(app->client, "/apps/celestia/visualMagnitude", app->simulation->getFaintestVisible(), NULL);
00448         #endif
00449 }

void actionStarStyle GtkRadioAction *  action,
GtkRadioAction *  ,
AppData app
 

Definition at line 633 of file actions.cpp.

Referenced by createMainMenu().

00634 {
00635         int value = gtk_radio_action_get_current_value(action);
00636         app->renderer->setStarStyle((Renderer::StarStyle)value);
00637         
00638         #ifdef GNOME
00639         gconf_client_set_int(app->client, "/apps/celestia/starStyle", value, NULL);
00640         #endif
00641 }

void actionSyncSelection GtkAction *  ,
AppData app
 

Definition at line 258 of file actions.cpp.

00259 {
00260         app->core->charEntered('Y');
00261 }

void actionSystemBrowser GtkAction *  ,
AppData app
 

Definition at line 270 of file actions.cpp.

References dialogSolarBrowser().

00271 {
00272         dialogSolarBrowser(app);
00273 }

void actionTimeFaster GtkAction *  ,
AppData app
 

Definition at line 288 of file actions.cpp.

00289 {
00290         app->core->charEntered('L');
00291 }

void actionTimeFreeze GtkAction *  ,
AppData app
 

Definition at line 300 of file actions.cpp.

00301 {
00302         app->core->charEntered(' ');
00303 }

void actionTimeLocal GtkAction *  action,
AppData app
 

Definition at line 324 of file actions.cpp.

References updateTimeZone().

00325 {
00326         app->showLocalTime = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
00327         updateTimeZone(app, app->showLocalTime);
00328 
00329         #ifdef GNOME
00330         gconf_client_set_bool(app->client, "/apps/celestia/showLocalTime", app->showLocalTime, NULL);
00331         #endif /* GNOME */
00332 }

void actionTimeReal GtkAction *  ,
AppData app
 

Definition at line 306 of file actions.cpp.

00307 {
00308         app->core->charEntered('\\');
00309 }

void actionTimeReverse GtkAction *  ,
AppData app
 

Definition at line 312 of file actions.cpp.

00313 {
00314         app->core->charEntered('J');
00315 }

void actionTimeSet GtkAction *  ,
AppData app
 

Definition at line 318 of file actions.cpp.

References dialogSetTime().

00319 {
00320         dialogSetTime(app);
00321 }

void actionTimeSlower GtkAction *  ,
AppData app
 

Definition at line 294 of file actions.cpp.

00295 {
00296         app->core->charEntered('K');
00297 }

void actionTourGuide GtkAction *  ,
AppData app
 

Definition at line 191 of file actions.cpp.

References dialogTourGuide().

00192 {
00193         dialogTourGuide(app);
00194 }

void actionTrackSelection GtkAction *  ,
AppData app
 

Definition at line 264 of file actions.cpp.

00265 {
00266         app->core->charEntered('T');
00267 }

void actionVerbosity GtkRadioAction *  action,
GtkRadioAction *  ,
AppData app
 

Definition at line 622 of file actions.cpp.

Referenced by createMainMenu().

00623 {
00624         int value = gtk_radio_action_get_current_value(action);
00625         app->core->setHudDetail(value);
00626         
00627         #ifdef GNOME
00628         gconf_client_set_int(app->client, "/apps/celestia/verbosity", value, NULL);
00629         #endif
00630 }

void actionViewerSize GtkAction *  ,
AppData app
 

Definition at line 335 of file actions.cpp.

References CELSPACING.

00336 {
00337         GtkWidget* dialog;
00338         int newX, currentX, currentY, winX, winY, screenX, i = 1, position = -1;
00339         char res[32];
00340         
00341         screenX = gdk_screen_get_width(gdk_screen_get_default());
00342         currentX = app->glArea->allocation.width;
00343         currentY = app->glArea->allocation.height;
00344 
00345         dialog = gtk_dialog_new_with_buttons("Set Viewer Size...",
00346                                              GTK_WINDOW(app->mainWindow),
00347                                              GTK_DIALOG_DESTROY_WITH_PARENT,
00348                                              GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
00349                                              GTK_STOCK_OK, GTK_RESPONSE_OK,
00350                                              NULL);
00351 
00352         GtkWidget* vbox = gtk_vbox_new(FALSE, CELSPACING); 
00353         gtk_container_set_border_width(GTK_CONTAINER(vbox), CELSPACING);
00354 
00355         GtkWidget* label = gtk_label_new("Dimensions for Main Window:");
00356         gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
00357 
00358         GtkWidget* menubox = gtk_combo_box_new_text();
00359         gtk_box_pack_start(GTK_BOX(vbox), menubox, FALSE, FALSE, 0);
00360 
00361         gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), vbox, TRUE, TRUE, 0);
00362 
00363         while (resolutions[i] != -1)
00364         {
00365                 if (position == -1 && resolutions[i-1] < currentX && resolutions[i] >= currentX)
00366                 {
00367                         sprintf(res, "%d x %d (current)", currentX, currentY);
00368                         position = i - 1;
00369                 }
00370                 else if (resolutions[i] < screenX)
00371                 {
00372                         sprintf(res, "%d x %d", resolutions[i], int(0.75 * resolutions[i]));
00373                         i++;
00374                 }
00375                 else
00376                         break;
00377                 
00378                 gtk_combo_box_append_text(GTK_COMBO_BOX(menubox), res);
00379         }
00380 
00381         gtk_combo_box_set_active(GTK_COMBO_BOX(menubox), position);
00382 
00383         gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK);
00384         gtk_widget_show_all(dialog);
00385 
00386         if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK)
00387         {
00388                 int active = gtk_combo_box_get_active(GTK_COMBO_BOX(menubox));
00389 
00390                 if (active > -1 && active != position)
00391                 {
00392                         /* Adjust for default entry */
00393                         if (active > position) active--;
00394 
00395                         newX = resolutions[active + 1];
00396                         gtk_window_get_size(GTK_WINDOW(app->mainWindow), &winX, &winY);
00397                         
00398                         /* Resizing takes into account border, titlebar, and menubar
00399                            sizes. Without them only an allocation can be requested */
00400                         gtk_window_resize(GTK_WINDOW(app->mainWindow), newX + winX - currentX, int(0.75 * newX) + winY - currentY);
00401                 }
00402         }
00403         
00404         gtk_widget_destroy(GTK_WIDGET(dialog));
00405 }

void actionViewOptions GtkAction *  ,
AppData app
 

Definition at line 436 of file actions.cpp.

References dialogViewOptions().

00437 {
00438         dialogViewOptions(app);
00439 }

static void captureImage const char *  filename,
AppData app
[static]
 

Definition at line 927 of file actions.cpp.

References CaptureGLBufferToJPEG(), CaptureGLBufferToPNG(), Content_JPEG, Content_PNG, Content_Unknown, and DetermineFileType().

Referenced by actionCaptureImage().

00928 {
00929         /* Get the dimensions of the current viewport */
00930         int viewport[4];
00931         glGetIntegerv(GL_VIEWPORT, viewport);
00932 
00933         bool success = false;
00934         ContentType type = DetermineFileType(filename);
00935         if (type == Content_Unknown)
00936         {
00937                 GtkWidget* errBox = gtk_message_dialog_new(GTK_WINDOW(app->mainWindow),
00938                                                            GTK_DIALOG_DESTROY_WITH_PARENT,
00939                                                            GTK_MESSAGE_ERROR,
00940                                                            GTK_BUTTONS_OK,
00941                                                            "Unable to determine image file type from name, please use a name ending in '.jpg' or '.png'.");
00942                 gtk_dialog_run(GTK_DIALOG(errBox));
00943                 gtk_widget_destroy(errBox);
00944                 return;
00945         }
00946         else if (type == Content_JPEG)
00947         {
00948                 success = CaptureGLBufferToJPEG(filename,
00949                                                 viewport[0], viewport[1],
00950                                                 viewport[2], viewport[3]);
00951         }
00952         else if (type == Content_PNG)
00953         {
00954                 success = CaptureGLBufferToPNG(filename,
00955                                                viewport[0], viewport[1],
00956                                                viewport[2], viewport[3]);
00957         }
00958         else
00959         {
00960                 GtkWidget* errBox = gtk_message_dialog_new(GTK_WINDOW(app->mainWindow),
00961                                                            GTK_DIALOG_DESTROY_WITH_PARENT,
00962                                                            GTK_MESSAGE_ERROR,
00963                                                            GTK_BUTTONS_OK,
00964                                                            "Currently screen capturing to only JPEG or PNG files is supported.");
00965                 gtk_dialog_run(GTK_DIALOG(errBox));
00966                 gtk_widget_destroy(errBox);
00967                 return;
00968         }
00969 
00970         if (!success)
00971         {
00972                 GtkWidget* errBox = gtk_message_dialog_new(GTK_WINDOW(app->mainWindow),
00973                                                            GTK_DIALOG_DESTROY_WITH_PARENT,
00974                                                            GTK_MESSAGE_ERROR,
00975                                                            GTK_BUTTONS_OK,
00976                                                            "Error writing captured image.");
00977                 gtk_dialog_run(GTK_DIALOG(errBox));
00978                 gtk_widget_destroy(errBox);
00979         }
00980 }

static void openScript const char *  filename,
AppData app
[static]
 

Definition at line 860 of file actions.cpp.

References Content_CelestiaLegacyScript, Content_CelestiaScript, DetermineFileType(), CommandParser::getErrors(), and CommandParser::parse().

Referenced by actionOpenScript().

00861 {
00862         /* Modified From Win32 HandleOpenScript */
00863         if (filename)
00864         {
00865                 /* If you got here, a path and file has been specified.
00866                  * filename contains full path to specified file. */
00867                 ContentType type = DetermineFileType(filename);
00868 
00869                 if (type == Content_CelestiaScript)
00870                 {
00871                         app->core->runScript(filename);
00872                 }
00873                 else if (type == Content_CelestiaLegacyScript)
00874                 {
00875                         ifstream scriptfile(filename);
00876                         if (!scriptfile.good())
00877                         {
00878                                 GtkWidget* errBox = gtk_message_dialog_new(GTK_WINDOW(app->mainWindow),
00879                                                                            GTK_DIALOG_DESTROY_WITH_PARENT,
00880                                                                            GTK_MESSAGE_ERROR,
00881                                                                            GTK_BUTTONS_OK,
00882                                                                            "Error opening script file.");
00883                                 gtk_dialog_run(GTK_DIALOG(errBox));
00884                                 gtk_widget_destroy(errBox);
00885                         }
00886                         else
00887                         {
00888                                 CommandParser parser(scriptfile);
00889                                 CommandSequence* script = parser.parse();
00890                                 if (script == NULL)
00891                                 {
00892                                         const vector<string>* errors = parser.getErrors();
00893                                         const char* errorMsg = "";
00894                                         if (errors->size() > 0)
00895                                                 errorMsg = (*errors)[0].c_str();
00896                                         GtkWidget* errBox = gtk_message_dialog_new(GTK_WINDOW(app->mainWindow),
00897                                                                                    GTK_DIALOG_DESTROY_WITH_PARENT,
00898                                                                                    GTK_MESSAGE_ERROR,
00899                                                                                    GTK_BUTTONS_OK, "%s",
00900                                                                                    errorMsg);
00901                                         gtk_dialog_run(GTK_DIALOG(errBox));
00902                                         gtk_widget_destroy(errBox);
00903                                 }
00904                                 else
00905                                 {
00906                                         /* Cancel any running script */
00907                                         app->core->cancelScript();
00908                                         app->core->runScript(script);
00909                                 }
00910                         }
00911                 }
00912                 else
00913                 {
00914                         GtkWidget* errBox = gtk_message_dialog_new(GTK_WINDOW(app->mainWindow),
00915                                                                    GTK_DIALOG_DESTROY_WITH_PARENT,
00916                                                                    GTK_MESSAGE_ERROR,
00917                                                                    GTK_BUTTONS_OK,
00918                                                                    "Bad File Type. Use *.(cel|celx|clx).");
00919                         gtk_dialog_run(GTK_DIALOG(errBox));
00920                         gtk_widget_destroy(errBox);
00921                 }
00922         }
00923 }

void resyncAmbientActions AppData app  ) 
 

Definition at line 1210 of file actions.cpp.

Referenced by initRealize(), and GtkWatcher::notifyChange().

01211 {
01212         GtkAction* action;
01213 
01214         float ambient = app->renderer->getAmbientLightLevel();
01215         
01216         /* Try to be smart about being close to the value of a float */
01217         if (ambient > amLevels[0] && ambient < (amLevels[1] / 2.0))
01218                 action = gtk_action_group_get_action(app->agAmbient, "AmbientNone");
01219         
01220         else if (ambient < amLevels[1] + ((amLevels[2] - amLevels[1]) / 2.0))
01221                 action = gtk_action_group_get_action(app->agAmbient, "AmbientLow");
01222         
01223         else
01224                 action = gtk_action_group_get_action(app->agAmbient, "AmbientMedium");
01225         
01226         gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), TRUE);
01227         
01228         #ifdef GNOME
01229         /* The action callback only occurs when one of the None/Low/Medium barriers
01230          * is surpassed, so an update is forced. */
01231         gconf_client_set_float(app->client, "/apps/celestia/ambientLight", ambient, NULL);
01232         #endif
01233 }

void resyncGalaxyGainActions AppData app  ) 
 

Definition at line 1257 of file actions.cpp.

References gain(), and Galaxy::getLightGain().

Referenced by GtkWatcher::notifyChange().

01258 {
01259         float gain = Galaxy::getLightGain();
01260         
01261         #ifdef GNOME
01262         gconf_client_set_float(app->client, "/apps/celestia/galaxyLightGain", gain, NULL);
01263         #endif
01264 }

void resyncLabelActions AppData app  ) 
 

Definition at line 1056 of file actions.cpp.

Referenced by initRealize(), and GtkWatcher::notifyChange().

01057 {
01058         GtkAction* action;
01059         const char* actionName;
01060         
01061         /* Simply for readability */
01062         int f = app->renderer->getLabelMode();
01063         
01064         for (int i = Renderer::StarLabels; i <= Renderer::I18nConstellationLabels; i *= 2)
01065         {
01066                 switch (i)
01067                 {
01068                         case Renderer::StarLabels: actionName = "LabelStars"; break;
01069                         case Renderer::PlanetLabels: actionName = "LabelPlanets"; break;
01070                         case Renderer::MoonLabels: actionName = "LabelMoons"; break;
01071                         case Renderer::ConstellationLabels: actionName = "LabelConstellations"; break;
01072                         case Renderer::GalaxyLabels: actionName = "LabelGalaxies"; break;
01073                         case Renderer::AsteroidLabels: actionName = "LabelAsteroids"; break;
01074                         case Renderer::SpacecraftLabels: actionName = "LabelSpacecraft"; break;
01075                         case Renderer::LocationLabels: actionName = "LabelLocations"; break;
01076                         case Renderer::CometLabels: actionName = "LabelComets"; break;
01077                         case Renderer::NebulaLabels: actionName = "LabelNebulae"; break;
01078                         case Renderer::OpenClusterLabels: actionName = "LabelOpenClusters"; break;
01079                         case Renderer::I18nConstellationLabels: /* Not used yet */
01080                         default: actionName = NULL;
01081                 }
01082                 
01083                 if (actionName != NULL)
01084                 {
01085                         /* Get the action */
01086                         action = gtk_action_group_get_action(app->agLabel, actionName);
01087                         
01088                         /* The current i anded with the labelMode gives state of flag */
01089                         gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), (i & f));
01090                 }
01091         }
01092 }

void resyncOrbitActions AppData app  ) 
 

Definition at line 1148 of file actions.cpp.

Referenced by initRealize(), and GtkWatcher::notifyChange().

01149 {
01150         GtkAction* action;
01151         const char* actionName;
01152         
01153         /* Simply for readability */
01154         int om = app->renderer->getOrbitMask();
01155         
01156         for (int i = Body::Planet; i <= Body::Spacecraft; i *= 2)
01157         {
01158                 switch (i)
01159                 {
01160                         case Body::Planet: actionName = "OrbitPlanets"; break;
01161                         case Body::Moon: actionName = "OrbitMoons"; break;
01162                         case Body::Asteroid: actionName = "OrbitAsteroids"; break;
01163                         case Body::Comet: actionName = "OrbitComets"; break;
01164                         case Body::Spacecraft: actionName = "OrbitSpacecraft"; break;
01165                         default: actionName = NULL;
01166                 }
01167                 
01168                 if (actionName != NULL)
01169                 {
01170                         /* Get the action */
01171                         action = gtk_action_group_get_action(app->agOrbit, actionName);
01172                         
01173                         /* The current i anded with the orbitMask gives state of flag */
01174                         gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), (i & om));
01175                 }
01176         }
01177 }

void resyncRenderActions AppData app  ) 
 

Definition at line 1096 of file actions.cpp.

Referenced by initRealize(), and GtkWatcher::notifyChange().

01097 {
01098         GtkAction* action;
01099         const char* actionName;
01100         
01101         /* Simply for readability */
01102         int rf = app->renderer->getRenderFlags();
01103         
01104         /* Unlike the other interfaces, which go through each menu item and set
01105          * the corresponding renderFlag, we go the other way and set the menu
01106          * based on the renderFlag. Last one is ShowOpenClusters. */
01107         
01108         for (int i = Renderer::ShowStars; i <= Renderer::ShowOpenClusters; i *= 2)
01109         {
01110                 switch (i)
01111                 {
01112                         case Renderer::ShowStars: actionName = "RenderStars"; break;
01113                         case Renderer::ShowPlanets: actionName = "RenderPlanets"; break;
01114                         case Renderer::ShowGalaxies: actionName = "RenderGalaxies"; break;
01115                         case Renderer::ShowDiagrams: actionName = "RenderConstellations"; break;
01116                         case Renderer::ShowCloudMaps: actionName = "RenderClouds"; break;
01117                         case Renderer::ShowOrbits: actionName = "RenderOrbits"; break;
01118                         case Renderer::ShowCelestialSphere: actionName = "RenderCelestialGrid"; break;
01119                         case Renderer::ShowNightMaps: actionName = "RenderNightLights"; break;
01120                         case Renderer::ShowAtmospheres: actionName = "RenderAtmospheres"; break;
01121                         case Renderer::ShowSmoothLines: actionName = "RenderAA"; break;
01122                         case Renderer::ShowEclipseShadows: actionName = "RenderEclipseShadows"; break;
01123                         case Renderer::ShowStarsAsPoints: actionName = NULL; break; /* Deprecated */
01124                         case Renderer::ShowRingShadows: actionName = "RenderRingShadows"; break;
01125                         case Renderer::ShowBoundaries: actionName = "RenderConstellationBoundaries"; break;
01126                         case Renderer::ShowAutoMag: actionName = "RenderAutoMagnitude"; break;
01127                         case Renderer::ShowCometTails: actionName = "RenderCometTails"; break;
01128                         case Renderer::ShowMarkers: actionName = "RenderMarkers"; break;
01129                         case Renderer::ShowPartialTrajectories: actionName = NULL; break; /* Not useful yet */
01130                         case Renderer::ShowNebulae: actionName = "RenderNebulae"; break;
01131                         case Renderer::ShowOpenClusters: actionName = "RenderOpenClusters"; break;
01132                         default: actionName = NULL;
01133                 }
01134                 
01135                 if (actionName != NULL)
01136                 {
01137                         /* Get the action */
01138                         action = gtk_action_group_get_action(app->agRender, actionName);
01139                         
01140                         /* The current i anded with the renderFlags gives state of flag */
01141                         gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), (i & rf));
01142                 }
01143         }
01144 }

void resyncStarStyleActions AppData app  ) 
 

Definition at line 1237 of file actions.cpp.

Referenced by initRealize(), and GtkWatcher::notifyChange().

01238 {
01239         GtkAction* action;
01240         const char* actionName;
01241         
01242         switch (app->renderer->getStarStyle())
01243         {
01244                 case Renderer::FuzzyPointStars: actionName = "StarsFuzzy"; break;
01245                 case Renderer::PointStars: actionName = "StarsPoints"; break;
01246                 case Renderer::ScaledDiscStars: actionName = "StarsDiscs"; break;
01247                 default: return;
01248         }
01249         
01250         /* Get the action, set the widget */
01251         action = gtk_action_group_get_action(app->agStarStyle, actionName);
01252         gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), TRUE);
01253 }

void resyncTimeZoneAction AppData app  ) 
 

Definition at line 1201 of file actions.cpp.

Referenced by GtkWatcher::notifyChange().

01202 {
01203         /* Get the action, set the widget */
01204         GtkAction* action = gtk_action_group_get_action(app->agMain, "TimeLocal");
01205         gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), app->showLocalTime);
01206 }

void resyncVerbosityActions AppData app  ) 
 

Definition at line 1181 of file actions.cpp.

Referenced by initRealize(), and GtkWatcher::notifyChange().

01182 {
01183         GtkAction* action;
01184         const char* actionName;
01185         
01186         switch (app->core->getHudDetail())
01187         {
01188                 case 0: actionName = "HudNone"; break;
01189                 case 1: actionName = "HudTerse"; break;
01190                 case 2: actionName = "HudVerbose"; break;
01191                 default: return;
01192         }
01193         
01194         /* Get the action, set the widget */
01195         action = gtk_action_group_get_action(app->agVerbosity, actionName);
01196         gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), TRUE);
01197 }

static void setLabelMode AppData a,
int  mode,
gboolean  state
[static]
 

Definition at line 1043 of file actions.cpp.

References gcSetLabelMode().

Referenced by actionLabelAsteroids(), actionLabelComets(), actionLabelConstellations(), actionLabelGalaxies(), actionLabelLocations(), actionLabelMoons(), actionLabelNebulae(), actionLabelOpenClusters(), actionLabelPlanets(), actionLabelSpacecraft(), and actionLabelStars().

01044 {
01045         int lm = (a->renderer->getLabelMode() & ~mode) | (state ? mode : 0);
01046         a->renderer->setLabelMode(lm);
01047         
01048         #ifdef GNOME
01049         /* Update GConf */
01050         gcSetLabelMode(mode, state, a->client);
01051         #endif /* GNOME */
01052 }

static void setOrbitMask AppData a,
int  mask,
gboolean  state
[static]
 

Definition at line 1030 of file actions.cpp.

References gcSetOrbitMask().

Referenced by actionOrbitAsteroids(), actionOrbitComets(), actionOrbitMoons(), actionOrbitPlanets(), and actionOrbitSpacecraft().

01031 {
01032         int om = (a->renderer->getOrbitMask() & ~mask) | (state ? mask : 0);
01033         a->renderer->setOrbitMask(om);
01034         
01035         #ifdef GNOME
01036         /* Update GConf */
01037         gcSetOrbitMask(mask, state, a->client);
01038         #endif /* GNOME */
01039 }

static void setRenderFlag AppData a,
int  flag,
gboolean  state
[static]
 

Definition at line 1017 of file actions.cpp.

References gcSetRenderFlag().

Referenced by actionRenderAA(), actionRenderAtmospheres(), actionRenderAutoMagnitude(), actionRenderCelestialGrid(), actionRenderClouds(), actionRenderCometTails(), actionRenderConstellationBoundaries(), actionRenderConstellations(), actionRenderEclipseShadows(), actionRenderGalaxies(), actionRenderMarkers(), actionRenderNebulae(), actionRenderNightLights(), actionRenderOpenClusters(), actionRenderOrbits(), actionRenderPlanets(), actionRenderRingShadows(), and actionRenderStars().

01018 {
01019         int rf = (a->renderer->getRenderFlags() & ~flag) | (state ? flag : 0);
01020         a->renderer->setRenderFlags(rf);
01021         
01022         #ifdef GNOME
01023         /* Update GConf */
01024         gcSetRenderFlag(flag, state, a->client);
01025         #endif /* GNOME */
01026 }

static void textInfoDialog const char *  txt,
const char *  title,
AppData app
[static]
 

Definition at line 985 of file actions.cpp.

Referenced by actionHelpControls(), and actionHelpOpenGL().

00986 {
00987         /* I would use a gnome_message_box dialog for this, except they don't seem
00988          * to notice that the texts are so big that they create huge windows, and
00989          * would work better with a scrolled window. Deon */
00990         GtkWidget* dialog = gtk_dialog_new_with_buttons(title,
00991                                                         GTK_WINDOW(app->mainWindow),
00992                                                         GTK_DIALOG_DESTROY_WITH_PARENT,
00993                                                         GTK_STOCK_OK, GTK_RESPONSE_OK,
00994                                                         NULL);
00995 
00996         GtkWidget* scrolled_window = gtk_scrolled_window_new (NULL, NULL);
00997         gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), scrolled_window, TRUE, TRUE, 0);
00998         gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrolled_window),
00999                                        GTK_POLICY_AUTOMATIC,
01000                                        GTK_POLICY_AUTOMATIC);
01001         gtk_widget_show(scrolled_window);
01002 
01003         GtkWidget *text = gtk_label_new(txt);
01004         gtk_widget_modify_font(text, pango_font_description_from_string("mono"));
01005         gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window), GTK_WIDGET(text));
01006         gtk_widget_show(text);
01007         
01008         gtk_window_set_default_size(GTK_WINDOW(dialog), 600, 400); /* Absolute Size, urghhh */
01009         gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK);
01010 
01011         gtk_dialog_run(GTK_DIALOG(dialog));
01012         gtk_widget_destroy(dialog);
01013 }


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