public Earth3d() { AudioPlayer.Initialize(); this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true); if (!HideSplash) { Splash.ShowSplashScreen(); } // Set the initial size of our form this.ClientSize = new System.Drawing.Size(400, 300); // And its caption config = new Config(); this.MonitorX = config.MonitorX; this.MonitorY = config.MonitorY; this.MonitorCountX = config.MonitorCountX; this.MonitorCountY = config.MonitorCountY; this.monitorHeight = config.Height; this.monitorWidth = config.Width; this.bezelSpacing = (float)config.Bezel; ProjectorServer = !config.Master; if (DomeViewer) { ProjectorServer = true; } multiMonClient = !config.Master && (MonitorCountX > 1 || MonitorCountY > 1); InitializeComponent(); SetUiStrings(); this.Text = Language.GetLocalizedText(3, "Microsoft WorldWide Telescope"); if (!InitializeGraphics()) { UiTools.ShowMessageBox(Language.GetLocalizedText(4, "You need 3d Graphics and DirectX installed to run this application"), Language.GetLocalizedText(3, "Microsoft WorldWide Telescope"), MessageBoxButtons.OK, MessageBoxIcon.Stop); Close(); } // This code is used for dumping shader code when porting to Windows RT/phone where compiling shaders is not possible at runtime if (DumpShaders) { //ShaderLibrary.DumpShaderLibrary(); } if (!InitializeImageSets()) { Close(); } BackInitDelegate initBackground = BackgroundInit; initBackground.BeginInvoke(null, null); if (TargetScreenId != -1) { try { this.StartPosition = FormStartPosition.Manual; Screen screenTarget; screenTarget = Screen.AllScreens[TargetScreenId]; this.Top = screenTarget.WorkingArea.Y; this.Left = screenTarget.WorkingArea.X; } catch { } } }
private void MainWndow_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if (uiController != null) { if (uiController.KeyDown(sender, e)) { return; } } if (Control.ModifierKeys == Keys.Alt) { switch (e.KeyCode) { case Keys.OemMinus: case Keys.PageUp: case Keys.Subtract: zoomSpeed = (ZoomSpeeds)Properties.Settings.Default.ZoomSpeed; ZoomOut(); break; case Keys.PageDown: case Keys.Oemplus: case Keys.Add: zoomSpeed = (ZoomSpeeds)Properties.Settings.Default.ZoomSpeed; ZoomIn(); break; case Keys.F1: LaunchHelp(); break; case Keys.F5: TileCache.ClearCache(); Tile.fastLoad = true; Tile.iTileBuildCount = 0; break; case Keys.Left: RotateView(0, -.05); break; case Keys.Right: RotateView(0, .05); break; case Keys.Up: RotateView(-.01, 0); break; case Keys.Down: RotateView(.01, 0); break; } } else if (Control.ModifierKeys == Keys.Control) { switch (e.KeyCode) { case Keys.F9: config = new Config(); break; case Keys.A: useAsymetricProj = !useAsymetricProj; break; case Keys.F5: Tile.PurgeRefresh = true; Render(); Tile.PurgeRefresh = false; TileCache.ClearCache(); break; case Keys.E: if (uiController == null) { // We can't really tell where this image came from so dirty everything. FolderBrowser.AllDirty = true; uiController = new ImageAlignmentUI(); Earth3d.MainWindow.StudyOpacity = 50; } else { if (uiController != null && uiController is ImageAlignmentUI) { ((ImageAlignmentUI)uiController).Close(); } uiController = null; } break; case Keys.L: Logging = !Logging; break; case Keys.T: targetViewCamera = viewCamera = CustomTrackingParams; break; } } else { switch (e.KeyCode) { case Keys.Z: riftFov *= .99f; this.Text = riftFov.ToString(); break; case Keys.X: riftFov *= 1.01f; this.Text = riftFov.ToString(); break; case Keys.C: iod *= .99f; break; case Keys.V: iod *= 1.01f; break; case Keys.F: SpaceTimeController.Faster(); break; case Keys.S: SpaceTimeController.Slower(); break; case Keys.H: // turn friction on and off Friction = !Friction; break; case Keys.P: SpaceTimeController.PauseTime(); break; case Keys.N: SpaceTimeController.SetRealtimeNow(); break; case Keys.B: blink = !blink; break; case Keys.L: RenderContext11.SetLatency(3); break; case Keys.K: RenderContext11.SetLatency(1); break; case Keys.F5: TileCache.ClearCache(); Tile.iTileBuildCount = 0; break; case Keys.F11: ShowFullScreen(!fullScreen); break; case Keys.OemMinus: case Keys.PageUp: case Keys.Subtract: zoomSpeed = (ZoomSpeeds)Properties.Settings.Default.ZoomSpeed; ZoomOut(); break; case Keys.Oemplus: case Keys.PageDown: case Keys.Add: zoomSpeed = (ZoomSpeeds)Properties.Settings.Default.ZoomSpeed; ZoomIn(); break; case Keys.F3: break; case Keys.F1: LaunchHelp(); break; case Keys.F2: showWireFrame = !showWireFrame; break; case Keys.Left: Control c = UiTools.GetFocusControl(); MoveLeft(); break; case Keys.Right: MoveRight(); break; case Keys.Up: MoveUp(); break; case Keys.Down: MoveDown(); break; case Keys.Space: case Keys.Play: if (TourEdit != null) { TourEdit.PlayNow(false); } break; case Keys.Escape: if (fullScreen) { ShowFullScreen(false); } break; } } }