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

dialog-options.h File Reference

#include "common.h"

Include dependency graph for dialog-options.h:

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

Go to the source code of this file.

Functions

void dialogViewOptions (AppData *app)

Variables

static const char *const ambientLabels []
static const char *const infoLabels []


Function Documentation

void dialogViewOptions AppData app  ) 
 

Definition at line 36 of file dialog-options.cpp.

References CELSPACING, changeDistanceLimit(), checkButtonsFromAG(), DistanceSliderRange, log(), MaxDistanceLimit, and toggleButtonsFromAG().

Referenced by actionViewOptions().

00037 {
00038         /* This dialog is hidden and shown because it is likely to be used a lot
00039          * and the actions->widgets operations are fairly intensive. */
00040         if (app->optionDialog != NULL)
00041         {
00042                 gtk_window_present(GTK_WINDOW(app->optionDialog));
00043                 return;
00044         }
00045         
00046     app->optionDialog = gtk_dialog_new_with_buttons("View Options",
00047                                                     GTK_WINDOW(app->mainWindow),
00048                                                         GTK_DIALOG_DESTROY_WITH_PARENT,
00049                                                         GTK_STOCK_OK,
00050                                                         GTK_RESPONSE_OK,
00051                                                         NULL);
00052         
00053         /* Create the main layout boxes */
00054     GtkWidget* hbox = gtk_hbox_new(FALSE, CELSPACING);
00055     GtkWidget* midBox = gtk_vbox_new(FALSE, CELSPACING);
00056     GtkWidget* miscBox = gtk_vbox_new(FALSE, CELSPACING);
00057 
00058         /* Create all of the frames */
00059         GtkWidget* showFrame = gtk_frame_new("Show");
00060         GtkWidget* orbitFrame = gtk_frame_new("Orbits");
00061         GtkWidget* labelFrame = gtk_frame_new("Label");
00062     GtkWidget* limitFrame = gtk_frame_new("Filter Stars");
00063     GtkWidget* infoFrame = gtk_frame_new("Info Text");
00064     GtkWidget* ambientFrame = gtk_frame_new("Ambient Light");
00065 
00066         /* Create the boxes that go in the frames */
00067         GtkWidget* showBox = gtk_vbox_new(FALSE, 0);
00068         GtkWidget* labelBox = gtk_vbox_new(FALSE, 0);
00069         GtkWidget* orbitBox = gtk_vbox_new(FALSE, 0);
00070         GtkWidget* limitBox = gtk_vbox_new(FALSE, 0);
00071         GtkWidget* infoBox = gtk_vbox_new(FALSE, 0);
00072         GtkWidget* ambientBox = gtk_vbox_new(FALSE, 0);
00073     
00074         /* Set border padding on the boxes */
00075         gtk_container_border_width(GTK_CONTAINER(showBox), CELSPACING);
00076         gtk_container_border_width(GTK_CONTAINER(labelBox), CELSPACING);
00077         gtk_container_border_width(GTK_CONTAINER(orbitBox), CELSPACING);
00078     gtk_container_border_width(GTK_CONTAINER(limitBox), CELSPACING);
00079     gtk_container_border_width(GTK_CONTAINER(ambientBox), CELSPACING);
00080     gtk_container_border_width(GTK_CONTAINER(infoBox), CELSPACING);
00081         
00082         /* Set border padding on the frames */
00083         gtk_container_border_width(GTK_CONTAINER(showFrame), 0);
00084         gtk_container_border_width(GTK_CONTAINER(labelFrame), 0);
00085         gtk_container_border_width(GTK_CONTAINER(orbitFrame), 0);
00086     gtk_container_border_width(GTK_CONTAINER(limitFrame), 0);
00087     gtk_container_border_width(GTK_CONTAINER(ambientFrame), 0);
00088     gtk_container_border_width(GTK_CONTAINER(infoFrame), 0);
00089         
00090         /* Place the boxes in the frames */
00091         gtk_container_add(GTK_CONTAINER(showFrame), GTK_WIDGET(showBox));
00092         gtk_container_add(GTK_CONTAINER(labelFrame), GTK_WIDGET(labelBox));
00093         gtk_container_add(GTK_CONTAINER(orbitFrame), GTK_WIDGET(orbitBox));
00094     gtk_container_add(GTK_CONTAINER(limitFrame),GTK_WIDGET(limitBox));
00095         gtk_container_add(GTK_CONTAINER(ambientFrame),GTK_WIDGET(ambientBox));
00096         gtk_container_add(GTK_CONTAINER(infoFrame),GTK_WIDGET(infoBox));
00097 
00098         /* Pack the frames into the top-level boxes and into the window */
00099     gtk_box_pack_start(GTK_BOX(hbox), showFrame, TRUE, TRUE, 0);
00100     gtk_box_pack_start(GTK_BOX(midBox), labelFrame, TRUE, TRUE, 0);
00101     gtk_box_pack_start(GTK_BOX(midBox), limitFrame, TRUE, TRUE, 0);
00102         gtk_box_pack_start(GTK_BOX(miscBox), orbitFrame, TRUE, TRUE, 0);
00103     gtk_box_pack_start(GTK_BOX(miscBox), ambientFrame, TRUE, TRUE, 0);
00104     gtk_box_pack_start(GTK_BOX(miscBox), infoFrame, TRUE, TRUE, 0);
00105     gtk_box_pack_start(GTK_BOX(hbox), midBox, TRUE, TRUE, 0);
00106     gtk_box_pack_start(GTK_BOX(hbox), miscBox, TRUE, TRUE, 0);
00107     gtk_box_pack_start(GTK_BOX(GTK_DIALOG (app->optionDialog)->vbox), hbox, TRUE,
00108                        TRUE, 0);
00109 
00110         gtk_container_set_border_width(GTK_CONTAINER(hbox), CELSPACING);
00111 
00112         float logDistanceLimit = log(app->renderer->getDistanceLimit()) / log((float)MaxDistanceLimit);
00113     GtkAdjustment *adj= (GtkAdjustment *)
00114                                                         gtk_adjustment_new((gfloat)(logDistanceLimit * DistanceSliderRange),
00115                                                0.0, DistanceSliderRange, 1.0, 2.0, 0.0);
00116 
00117         GtkWidget* magLabel = gtk_label_new(NULL);
00118         GtkWidget* slider = gtk_hscale_new(adj);
00119         g_object_set_data(G_OBJECT(slider), "valueLabel", magLabel);
00120         gtk_scale_set_draw_value(GTK_SCALE(slider), 0);
00121         gtk_box_pack_start(GTK_BOX(limitBox), slider, TRUE, TRUE, 0);
00122         gtk_box_pack_start(GTK_BOX(limitBox), magLabel, TRUE, TRUE, 0);
00123         g_signal_connect(GTK_OBJECT(slider), "value-changed", G_CALLBACK(changeDistanceLimit), app);
00124         changeDistanceLimit(GTK_RANGE(GTK_HSCALE(slider)), app);
00125 
00126         checkButtonsFromAG(actionsRenderFlags, G_N_ELEMENTS(actionsRenderFlags), app->agRender, showBox);
00127         checkButtonsFromAG(actionsOrbitFlags, G_N_ELEMENTS(actionsOrbitFlags), app->agOrbit, orbitBox);
00128         checkButtonsFromAG(actionsLabelFlags, G_N_ELEMENTS(actionsLabelFlags), app->agLabel, labelBox);
00129         toggleButtonsFromAG(actionsVerbosity, G_N_ELEMENTS(actionsVerbosity), app->agVerbosity, infoBox);
00130         toggleButtonsFromAG(actionsAmbientLight, G_N_ELEMENTS(actionsAmbientLight), app->agAmbient, ambientBox);
00131 
00132         g_signal_connect(app->optionDialog, "response",
00133                          G_CALLBACK(gtk_widget_hide), GTK_WIDGET(app->optionDialog));
00134 
00135         gtk_widget_show_all(hbox);
00136 
00137         gtk_dialog_set_default_response(GTK_DIALOG(app->optionDialog), GTK_RESPONSE_OK);
00138         gtk_window_present(GTK_WINDOW(app->optionDialog));
00139 }


Variable Documentation

const char* const ambientLabels[] [static]
 

Initial value:

{
    "None",
    "Low",
    "Medium",
    NULL
}

Definition at line 23 of file dialog-options.h.

const char* const infoLabels[] [static]
 

Initial value:

{
    "None",
    "Terse",
    "Verbose",
    NULL
}

Definition at line 31 of file dialog-options.h.


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