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

winlocations.cpp File Reference

#include "winlocations.h"
#include "res/resource.h"
#include <celutil/winutil.h>

Include dependency graph for winlocations.cpp:

Go to the source code of this file.

Functions

static void dlgCheck (HWND hDlg, WORD item, uint32 flags, uint32 f)
static BOOL APIENTRY LocationsProc (HWND hDlg, UINT message, UINT wParam, LONG lParam)

Variables

static const int FeatureSizeSliderRange = 100
static const uint32 FilterOther
static const float MaxFeatureSize = 100.0f
static const float MinFeatureSize = 1.0f


Function Documentation

static void dlgCheck HWND  hDlg,
WORD  item,
uint32  flags,
uint32  f
[static]
 

Definition at line 171 of file winlocations.cpp.

Referenced by ViewOptionsDialog::SetControls(), and LocationsDialog::SetControls().

00172 {
00173     SendDlgItemMessage(hDlg, item, BM_SETCHECK,
00174                        ((flags & f) != 0) ? BST_CHECKED : BST_UNCHECKED, 0);
00175 }

static BOOL APIENTRY LocationsProc HWND  hDlg,
UINT  message,
UINT  wParam,
LONG  lParam
[static]
 

Definition at line 31 of file winlocations.cpp.

References LocationsDialog::appCore, BOOL(), FeatureSizeSliderRange, FilterOther, Simulation::getActiveObserver(), Renderer::getLabelMode(), Observer::getLocationFilter(), Renderer::getMinimumFeatureSize(), CelestiaCore::getRenderer(), CelestiaCore::getSimulation(), IDC_EDIT_FEATURE_SIZE, IDC_LABELFEATURES, IDC_SHOW_CITIES, IDC_SHOW_CRATERS, IDC_SHOW_LANDING_SITES, IDC_SHOW_MARIA, IDC_SHOW_MONTES, IDC_SHOW_OBSERVATORIES, IDC_SHOW_OTHERS, IDC_SHOW_TERRAE, IDC_SHOW_VALLES, IDC_SLIDER_FEATURE_SIZE, LocationsDialog::initialFeatureSize, LocationsDialog::initialLocationFlags, MaxFeatureSize, MinFeatureSize, LocationsDialog::parent, LocationsDialog::RestoreSettings(), LocationsDialog::SetControls(), Renderer::setLabelMode(), Observer::setLocationFilter(), and Renderer::setMinimumFeatureSize().

Referenced by LocationsDialog::LocationsDialog().

00035 {
00036     LocationsDialog* dlg = reinterpret_cast<LocationsDialog*>(GetWindowLong(hDlg, DWL_USER));
00037 
00038     switch (message)
00039     {
00040     case WM_INITDIALOG:
00041         {
00042             dlg = reinterpret_cast<LocationsDialog*>(lParam);
00043             if (dlg == NULL)
00044                 return EndDialog(hDlg, 0);
00045             SetWindowLong(hDlg, DWL_USER, lParam);
00046 
00047             // Store original settings in case user cancels the dialog
00048             // dlg->initialLocationFlags = dlg->appCore->getSimulation()->getActiveObserver();
00049             dlg->initialLocationFlags = 0;
00050             dlg->initialFeatureSize = dlg->appCore->getRenderer()->getMinimumFeatureSize();
00051 
00052             // Set dialog controls to reflect current label and render modes
00053             dlg->SetControls(hDlg);
00054 
00055             return(TRUE);
00056         }
00057         break;
00058 
00059     case WM_COMMAND:
00060     {
00061         Observer* obs = dlg->appCore->getSimulation()->getActiveObserver();
00062         uint32 locationFilter = obs->getLocationFilter();
00063         
00064         switch (LOWORD(wParam))
00065         {
00066         case IDC_SHOW_CITIES:
00067             obs->setLocationFilter(locationFilter ^ Location::City);
00068             break;
00069         case IDC_SHOW_OBSERVATORIES:
00070             obs->setLocationFilter(locationFilter ^ Location::Observatory);
00071             break;
00072         case IDC_SHOW_LANDING_SITES:
00073             obs->setLocationFilter(locationFilter ^ Location::LandingSite);
00074             break;
00075         case IDC_SHOW_MONTES:
00076             obs->setLocationFilter(locationFilter ^ Location::Mons);
00077             break;
00078         case IDC_SHOW_MARIA:
00079             obs->setLocationFilter(locationFilter ^ Location::Mare);
00080             break;
00081         case IDC_SHOW_CRATERS:
00082             obs->setLocationFilter(locationFilter ^ Location::Crater);
00083             break;
00084         case IDC_SHOW_VALLES:
00085             obs->setLocationFilter(locationFilter ^ Location::Vallis);
00086             break;
00087         case IDC_SHOW_TERRAE:
00088             obs->setLocationFilter(locationFilter ^ Location::Terra);
00089             break;
00090         case IDC_SHOW_OTHERS:
00091             obs->setLocationFilter(locationFilter ^ FilterOther);
00092             break;
00093         case IDC_LABELFEATURES:
00094             {
00095                 Renderer* renderer = dlg->appCore->getRenderer();
00096                 uint32 labelMode = renderer->getLabelMode();
00097                 renderer->setLabelMode(labelMode ^ Renderer::LocationLabels);
00098                 break;
00099             }
00100         case IDOK:
00101             if (dlg != NULL && dlg->parent != NULL)
00102             {
00103                 SendMessage(dlg->parent, WM_COMMAND, IDCLOSE,
00104                             reinterpret_cast<LPARAM>(dlg));
00105             }
00106             EndDialog(hDlg, 0);
00107             return TRUE;
00108         case IDCANCEL:
00109             if (dlg != NULL && dlg->parent != NULL)
00110             {
00111                 // Reset render flags, label mode, and hud detail to
00112                 // initial values
00113                 dlg->RestoreSettings(hDlg);
00114                 SendMessage(dlg->parent, WM_COMMAND, IDCLOSE,
00115                             reinterpret_cast<LPARAM>(dlg));
00116             }
00117             EndDialog(hDlg, 0);
00118             return TRUE;
00119         }
00120         break;
00121     }
00122 
00123     case WM_DESTROY:
00124         if (dlg != NULL && dlg->parent != NULL)
00125         {
00126             SendMessage(dlg->parent, WM_COMMAND, IDCLOSE,
00127                         reinterpret_cast<LPARAM>(dlg));
00128         }
00129         return TRUE;
00130 
00131     case WM_HSCROLL:
00132         {
00133             WORD sbValue = LOWORD(wParam);
00134             LRESULT sliderPos;
00135             
00136             if (sbValue == SB_THUMBTRACK)
00137                 sliderPos = HIWORD(wParam);
00138             else                            
00139                 sliderPos = SendMessage(GetDlgItem(hDlg, IDC_SLIDER_FEATURE_SIZE), TBM_GETPOS, 0, 0);
00140                 
00141             char val[16];
00142             HWND hwnd = GetDlgItem(hDlg, IDC_EDIT_FEATURE_SIZE);
00143             float featureSize = (float) sliderPos / (float) FeatureSizeSliderRange;
00144             featureSize = MinFeatureSize + (MaxFeatureSize - MinFeatureSize) * featureSize;
00145             sprintf(val, "%d", (int) featureSize);
00146             SetWindowText(hwnd, val);
00147             
00148             dlg->appCore->getRenderer()->setMinimumFeatureSize(featureSize);                                    
00149         }
00150     }
00151 
00152     return FALSE;
00153 }


Variable Documentation

const int FeatureSizeSliderRange = 100 [static]
 

Definition at line 18 of file winlocations.cpp.

Referenced by LocationsProc(), and LocationsDialog::SetControls().

const uint32 FilterOther [static]
 

Initial value:

Definition at line 22 of file winlocations.cpp.

Referenced by LocationsProc().

const float MaxFeatureSize = 100.0f [static]
 

Definition at line 20 of file winlocations.cpp.

Referenced by LocationsProc(), and LocationsDialog::SetControls().

const float MinFeatureSize = 1.0f [static]
 

Definition at line 19 of file winlocations.cpp.

Referenced by LocationsProc(), and LocationsDialog::SetControls().


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