Example #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 public DrawPath(TrackDB trackDB, TrackSectionsFile tsectionDat)
 {
     this.trackDB           = trackDB;
     this.tsectionDat       = tsectionDat;
     this.ColorSchemeMain   = DrawColors.colorsPathMain;
     this.ColorSchemeSiding = DrawColors.colorsPathSiding;
     this.ColorSchemeLast   = DrawColors.ShadeColor(DrawColors.otherPathsReferenceColor, 0, 1);
 }
Example #2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// relation ontent.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            TVInputSettings.SetDefaults();

            // This control is purely here to capture focus and prevent it slipping out and on to the menu.
            Control.FromHandle(Window.Handle).Controls.Add(new TextBox()
            {
                Top = -100
            });

            statusBarControl = new StatusBarControl(this);
            menuControl      = new MenuControl(this);
            menuControl.PopulateLanguages();
            DrawColors.Initialize(menuControl);


            Localize(statusBarControl);
            Localize(menuControl);

            drawWorldTiles = new DrawWorldTiles();
            drawScaleRuler = new DrawScaleRuler();
            DrawArea       = new DrawArea(drawScaleRuler);
            drawAreaInset  = new ShadowDrawArea(null);
            drawAreaInset.StrictChecking = true;

            fontManager = FontManager.Instance;
            setSubwindowSizes();

            this.IsMouseVisible = true;

            // install folder
            if (String.IsNullOrEmpty(Properties.Settings.Default.installDirectory))
            {
                try
                {
                    Properties.Settings.Default.installDirectory = MSTS.MSTSPath.Base();
                }
                catch {}
            }
            InstallFolder = new Folder("default", Properties.Settings.Default.installDirectory);

            findRoutes(InstallFolder);

            drawPathChart = new DrawPathChart();

            base.Initialize();
        }
Example #3
0
        /// <summary>
        /// Update the (user) settings based on menu state
        /// </summary>
        void UpdateMenuSettings()
        {
            menuShowPATfile.IsEnabled = !menuEnableEditing.IsChecked;
            if (!menuShowPATfile.IsEnabled)
            {
                menuShowPATfile.IsChecked = false;
            }
            if (!menuShowSignals.IsChecked)
            {   // if signals are not shown, then also all signals cannot be shown.
                menuShowAllSignals.IsChecked = false;
            }
            if (menuShowStationNames.IsChecked)
            {
                menuShowPlatformNames.IsChecked = false;
            }

            if (menuShowTerrain.IsChecked || menuShowDMTerrain.IsChecked)
            {
                menuShowWorldTiles.IsChecked = false;
                menuShowWorldTiles.IsEnabled = false;
                menuShowPatchLines.IsEnabled = true;
            }
            else
            {
                menuShowWorldTiles.IsEnabled = true;
                menuShowPatchLines.IsEnabled = false;
            }

            Properties.Settings.Default.showInset           = menuShowInset.IsChecked;
            Properties.Settings.Default.showWorldTiles      = menuShowWorldTiles.IsChecked;
            Properties.Settings.Default.showGridLines       = menuShowGridLines.IsChecked;
            Properties.Settings.Default.colorTracks         = menuColorTracks.IsChecked;
            Properties.Settings.Default.showTrackHighlights = menuHighlightTracks.IsChecked;
            Properties.Settings.Default.showItemHighlights  = menuHighlightItems.IsChecked;

            Properties.Settings.Default.showJunctionNodes   = menuShowJunctionNodes.IsChecked;
            Properties.Settings.Default.showEndNodes        = menuShowEndNodes.IsChecked;
            Properties.Settings.Default.showCrossovers      = menuShowCrossovers.IsChecked;
            Properties.Settings.Default.showSidingMarkers   = menuShowSidingMarkers.IsChecked;
            Properties.Settings.Default.showSidingNames     = menuShowSidingNames.IsChecked;
            Properties.Settings.Default.showPlatformMarkers = menuShowPlatformMarkers.IsChecked;
            Properties.Settings.Default.showPlatformNames   = menuShowPlatformNames.IsChecked;
            Properties.Settings.Default.showStationNames    = menuShowStationNames.IsChecked;
            Properties.Settings.Default.showCrossings       = menuShowCrossings.IsChecked;
            Properties.Settings.Default.showSpeedLimits     = menuShowSpeedLimits.IsChecked;
            Properties.Settings.Default.showMileposts       = menuShowMileposts.IsChecked;
            Properties.Settings.Default.showSignals         = menuShowSignals.IsChecked;
            Properties.Settings.Default.showAllSignals      = menuShowAllSignals.IsChecked;
            Properties.Settings.Default.showHazards         = menuShowHazards.IsChecked;
            Properties.Settings.Default.showSoundRegions    = menuShowSoundRegions.IsChecked;
            Properties.Settings.Default.showPickups         = menuShowPickups.IsChecked;

            Properties.Settings.Default.showPATfile   = menuShowPATfile.IsChecked;
            Properties.Settings.Default.showTrainpath = menuShowTrainpath.IsChecked;

            Properties.Settings.Default.statusShowVectorSections = menuStatusShowVectorSection.IsChecked;
            Properties.Settings.Default.statusShowPATfile        = menuStatusShowPATfile.IsChecked && menuShowPATfile.IsChecked;
            Properties.Settings.Default.statusShowTrainpath      = menuStatusShowTrainpath.IsChecked && menuShowTrainpath.IsChecked;
            Properties.Settings.Default.statusShowTerrain        = menuStatusShowTerrain.IsChecked && (menuShowTerrain.IsChecked || menuShowDMTerrain.IsChecked);
            Properties.Settings.Default.statusShowSignal         = menuStatusShowSignal.IsChecked && menuShowSignals.IsChecked;

            Properties.Settings.Default.drawRoads         = menuDrawRoads.IsChecked;
            Properties.Settings.Default.showCarSpawners   = menuShowCarSpawners.IsChecked;
            Properties.Settings.Default.showRoadCrossings = menuShowRoadCrossings.IsChecked;

            Properties.Settings.Default.showScaleRuler    = menuShowScaleRuler.IsChecked;
            Properties.Settings.Default.showLonLat        = menuShowLonLat.IsChecked;
            Properties.Settings.Default.useMilesNotMeters = menuUseMilesNotMeters.IsChecked;

            Properties.Settings.Default.zoomIsCenteredOnMouse = menuZoomIsCenteredOnMouse.IsChecked;

            Properties.Settings.Default.Save();

            DrawColors.SetColoursFromOptions(menuColorTracks.IsChecked, menuShowWorldTiles.IsChecked, menuShowTerrain.IsChecked || menuShowDMTerrain.IsChecked);

            menuStatusShowPATfile.IsEnabled   = menuShowPATfile.IsChecked;
            menuStatusShowTrainpath.IsEnabled = menuShowTrainpath.IsChecked;
            menuStatusShowTerrain.IsEnabled   = menuShowTerrain.IsChecked || menuShowDMTerrain.IsChecked;
            menuStatusShowSignal.IsEnabled    = menuShowSignals.IsChecked;


            menuSelectPath.IsEnabled     = (trackViewer.CurrentRoute != null);
            menuNewPath.IsEnabled        = (trackViewer.CurrentRoute != null);
            menuShowOtherPaths.IsEnabled = (trackViewer.CurrentRoute != null);
            menuSavePath.IsEnabled       = (trackViewer.PathEditor != null);
            menuSaveStations.IsEnabled   = (trackViewer.PathEditor != null);
            menuShowChart.IsEnabled      = (trackViewer.PathEditor != null);
            menuEnableEditing.IsEnabled  = (trackViewer.PathEditor != null);
            menuEditMetadata.IsEnabled   = menuEnableEditing.IsChecked;
            menuReversePath.IsEnabled    = menuEnableEditing.IsChecked;
        }