public AddObjectDialog(AssetCollection assets)
        {
            InitializeComponent();

            this.assets = assets;

            PopulateTypeComboBox();
            if(!String.Equals(lastTypeSelected,""))
            {
                objectTypeComboBox.SelectedItem = lastTypeSelected;
            }
            if (objectComboBox.Items.Count > 0)
            {
                objectComboBox.SelectedIndex = 0;
            }
        }
        public AddObjectDialog(AssetCollection assets)
        {
            InitializeComponent();

            this.assets = assets;

            PopulateTypeComboBox();
            if (!String.Equals(lastTypeSelected, ""))
            {
                objectTypeComboBox.SelectedItem = lastTypeSelected;
            }
            if (objectComboBox.Items.Count > 0)
            {
                objectComboBox.SelectedIndex = 0;
            }
        }
        public WorldEditor()
        {
            undoRedo = new UndoRedo();
            InitializeComponent();
            config = new WorldEditorConfig();
            helpURL = config.HelpBaseURL;
            feedbackURL = config.FeedbackBaseURL;
            releaseNoteURL = config.ReleaseNotesURL;

            // create the default terrain generator
            terrainGenerator = DefaultTerrainGenerator();
            RepositoryClass.Instance.InitializeRepositoryPath();
            designateRepositoriesDialog = new DesignateRepositoriesDialog();
            List<string> validityLog = RepositoryClass.Instance.CheckForValidRepository();
            if (validityLog.Count != 0)
            {
                using (SetAssetRepositoryDialog dlg = new SetAssetRepositoryDialog(this))
                {
                    DialogResult result;

                    result = dlg.ShowDialog();
                    if (result != DialogResult.OK)
                    {
                        return;
                    }
                }
            }

            List<string> log = RepositoryClass.Instance.InitializeRepository();
            CheckLogAndMaybeExit(log);

            InitAxiomControl();
            instance = this;
            DisplayObject.collisionManager = collisionManager;
            assets = new AssetCollection();
            AssetListConverter.assetCollection = assets;
            SpeedWindFileListUITypeEditor.assetCollection = assets;
            TreeDescriptionFilenameUITypeEditor.assetCollection = assets;
            ImageNameUITypeEditor.assetCollection = assets;
            ParticleEffectNameUITypeEditor.assetCollection = assets;

            // Read in and set user preferences

            object ret;
            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "DisplayFog", (object)displayFog);
            if (ret == null || String.Equals(ret.ToString(), "True"))
            {
                ret = (object)true;
            }
            else
            {
                ret = (object)false;
            }
            displayFog = (bool)ret;
            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "DisplayLight", (object)displayLights);
            if (ret == null || String.Equals(ret.ToString(), "True"))
            {
                ret = (object)true;
            }
            else
            {
                ret = (object)false;
            }
            displayLights = (bool)ret;
            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "DisplayRegionMarkers", (object)true);
            if (ret == null || String.Equals(ret.ToString(), "True"))
            {
                ret = (object)true;
            }
            else
            {
                ret = (object)false;
            }
            displayBoundaryMarkers = (bool)ret;
            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "DisplayRoadMarkers", (object)true);
            if (ret == null || String.Equals(ret.ToString(), "True"))
            {
                ret = (object)true;
            }
            else
            {
                ret = (object)false;
            }
            displayRoadMarkers = (bool)ret;
            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "DisplayMarkerPoints", (object)true);
            if (ret == null || String.Equals(ret.ToString(), "True"))
            {
                ret = (object)true;
            }
            else
            {
                ret = (object)false;
            }
            displayMarkerPoints = (bool)ret;
            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "DisplayPointLightMarkers", (object)true);
            if (ret == null || String.Equals(ret.ToString(), "True"))
            {
                ret = (object)true;
            }
            else
            {
                ret = (object)false;
            }
            displayPointLightMarker = (bool)ret;
            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "Disable All Markers", (object)false);
            if (ret == null || String.Equals(ret.ToString(), "False"))
            {
                ret = (object)false;
            }
            else
            {
                ret = (object)true;
            }
            disableAllMarkers = (bool)ret;
            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "Display Terrain Decals", (object)true);
            if (ret == null || String.Equals(ret.ToString(), "True"))
            {
                ret = (object)true;
            }
            else
            {
                ret = (object)false;
            }
            displayTerrainDecals = (bool)ret;
            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "LockCameraToObject", (object)false);
            if (ret == null || String.Equals(ret.ToString(), "False"))
            {
                ret = (object)false;
            }
            else
            {
                ret = (object)true;
            }
            lockCameraToObject = (bool)ret;
            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "CameraFollowsTerrain", (object)false);
            if (ret == null || String.Equals(ret.ToString(), "False"))
            {
                ret = (object)false;
            }
            else
            {
                ret = (object)true;
            }
            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "CameraStaysAboveTerrain", (object)true);
            if (ret == null || String.Equals(ret.ToString(), "True"))
            {
                ret = (object)true;
            }
            else
            {
                ret = (object)false;
            }
            cameraAboveTerrain = (bool)ret;
            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "DisplayOcean", (object)DisplayOcean);
            if (ret == null || String.Equals(ret.ToString(), "True"))
            {
                ret = (object)true;
            }
            else
            {
                ret = (object)false;
            }
            DisplayOcean = (bool)ret;
            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "DisplayShadows", (object)false);
            if (ret == null || String.Equals(ret.ToString(), "False"))
            {
                ret = (object)false;
            }
            else
            {
                ret = (object)true;
            }
            DisplayShadows = (bool)ret;
            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "CameraNearDistance", (object)1f);
            if (ret == null)
            {
                ret = (object)1f;
            }
            CameraNearDistance = float.Parse(ret.ToString());
            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "AutoSaveEnable", (object)autoSaveEnabled);
            if (ret == null || String.Equals(ret.ToString(), "True"))
            {
                ret = (object)true;
            }
            else
            {
                ret = (object)false;
            }
            autoSaveEnabled = (bool)ret;
            if (ret == null || String.Equals(ret.ToString(), "True"))
            {
                ret = (object)true;
            }
            else
            {
                ret = (object)false;
            }
            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "AutoSaveTime", (object)autoSaveTime);
            if (ret == null)
            {
                autoSaveTime = 30 * 60 * 1000;
            }
            else
            {
                autoSaveTime = uint.Parse(ret.ToString());
            }

            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "CameraDefaultSpeed", (object)(Config.DefaultCamSpeed));
            if (ret != null)
            {
                camSpeed = float.Parse(ret.ToString());
            }
            else
            {
                camSpeed = Config.DefaultCamSpeed;
            }
            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "CameraSpeedIncrement", (object)(Config.DefaultCamSpeedIncrement));
            if (ret != null)
            {
                camSpeedIncrement = float.Parse(ret.ToString());
            }
            else
            {
                camSpeedIncrement = Config.DefaultCamSpeedIncrement;
            }
            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "PresetCameraSpeed1", (object)(Config.DefaultPresetCamSpeed1));
            if (ret != null)
            {
                presetCameraSpeed1 = float.Parse(ret.ToString());
            }
            else
            {
                presetCameraSpeed1 = Config.DefaultPresetCamSpeed1;
            }
            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "PresetCameraSpeed2", (object)(Config.DefaultPresetCamSpeed2));
            if (ret != null)
            {
                presetCameraSpeed2 = float.Parse(ret.ToString());
            }
            else
            {
                presetCameraSpeed2 = config.DefaultPresetCamSpeed2;
            }
            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "PresetCameraSpeed3", (object)(Config.DefaultPresetCamSpeed3));
            if (ret != null)
            {
                presetCameraSpeed3 = float.Parse(ret.ToString());
            }
            else
            {
                presetCameraSpeed3 = Config.DefaultPresetCamSpeed3;
            }
            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "PresetCameraSpeed4", (object)(Config.DefaultPresetCamSpeed4));
            if (ret != null)
            {
                presetCameraSpeed4 = float.Parse(ret.ToString());
            }
            else
            {
                presetCameraSpeed4 = Config.DefaultPresetCamSpeed4;
            }

            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "CameraAccelerate", (object)Config.DefaultAccelerateCamera);
            if (ret != null && String.Equals(ret.ToString(), "False"))
            {
                accelerateCamera = false;
            }
            else
            {
                accelerateCamera = true;
            }

            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "CameraAccelerationRate", (object)(Config.DefaultCamAccelRate));
            if (ret != null)
            {
                defaultCamAccelSpeed = float.Parse(ret.ToString());
            }
            else
            {
                defaultCamAccelSpeed = Config.DefaultCamAccelRate;
            }
            camAccel = defaultCamAccelSpeed;
            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "CameraAccelerationIncrement", (object)(Config.DefaultCamAccelRateIncrement));
            if (ret != null)
            {
                camAccelIncrement = float.Parse(ret.ToString());
            }
            else
            {
                camAccelIncrement = Config.DefaultCamAccelRateIncrement;
            }

            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "PresetCameraAccelRate1", (object)(Config.DefaultPresetCamAccel1));
            if (ret != null)
            {
                presetCameraAccel1 = float.Parse(ret.ToString());
            }
            else
            {
                presetCameraAccel1 = Config.DefaultPresetCamAccel1;
            }

            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "PresetCameraAccelRate2", (object)(Config.DefaultPresetCamAccel2));
            if (ret != null)
            {
                presetCameraAccel2 = float.Parse(ret.ToString());
            }
            else
            {
                presetCameraAccel2 = Config.DefaultPresetCamAccel2;
            }
            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "PresetCameraAccelRate3", (object)(Config.DefaultPresetCamAccel3));
            if (ret != null)
            {
                presetCameraAccel3 = float.Parse(ret.ToString());
            }
            else
            {
                presetCameraAccel3 = Config.DefaultPresetCamAccel3;
            }
            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "PresetCameraAccelRate4", (object)(Config.DefaultPresetCamAccel4));
            if (ret != null)
            {
                presetCameraAccel4 = float.Parse(ret.ToString());
            }
            else
            {
                presetCameraAccel4 = Config.DefaultPresetCamAccel4;
            }

            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "CameraTurnRate", (object)Config.DefaultCameraTurnRate);
            if (ret != null)
            {
                cameraTurnIncrement = float.Parse(ret.ToString());
            }
            else
            {
                cameraTurnIncrement = Config.DefaultCameraTurnRate;
            }

            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "MouseWheelMultiplier", (object)Config.DefaultMouseWheelMultiplier);
            if (ret != null)
            {
                mouseWheelMultiplier = float.Parse(ret.ToString());
            }
            else
            {
                mouseWheelMultiplier = Config.DefaultMouseWheelMultiplier;
            }

            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "MWMPreset1", (object)Config.DefaultPresetMWM1);
            if (ret != null)
            {
                presetMWM1 = float.Parse(ret.ToString());
            }
            else
            {
                presetMWM1 = Config.DefaultPresetMWM1;
            }

            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "MWMPreset2", (object)Config.DefaultPresetMWM2);
            if (ret != null)
            {
                presetMWM2 = float.Parse(ret.ToString());
            }
            else
            {
                presetMWM2 = Config.DefaultPresetMWM2;
            }

            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "MWMPreset3", (object)Config.DefaultPresetMWM3);
            if (ret != null)
            {
                presetMWM3 = float.Parse(ret.ToString());
            }
            else
            {
                presetMWM3 = Config.DefaultPresetMWM3;
            }

            ret = Registry.GetValue(Config.WorldEditorBaseRegistryKey, "MWMPreset4", (object)Config.DefaultPresetMWM4);
            if (ret != null)
            {
                presetMWM4 = float.Parse(ret.ToString());
            }
            else
            {
                presetMWM4 = Config.DefaultPresetMWM4;
            }

            setToolStripMWMDropDownMenu();

            setToolStripAccelSpeedDropDownMenu();

            random = new Random();

            templates = new NameValueTemplateCollection("./NameValueTemplates");
            NameValueUITypeEditor.nvt = templates;

            xmlWriterSettings = new XmlWriterSettings();
            xmlWriterSettings.Indent = true;

            xmlReaderSettings = new XmlReaderSettings();

            createKeybindings();

            StatusBarAddItem(fpsStatusValueLabel);
            StatusBarAddItem(mouseGroundCoorPanel);
            StatusBarAddItem(cameraSpeedStatusLabel);
            StatusBarAddItem(cameraStatusLabel);
            activeBoundaryListToolStripStatusLabel.Name = "activeBoundaryList";

            RepositoryClass.Instance.InitializeRepositoryPath();

            timerFreq = Stopwatch.Frequency;

            lastFrameTime = Stopwatch.GetTimestamp();

            showPathDialog = new ShowPathDialog();
        }