private void dataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (e.RowIndex < 0 || e.RowIndex >= _dataGridViewDataSource.Count) { return; } if (dataGridView.Columns[e.ColumnIndex].Name == errorMessageColumn.Name) { ImportedGeometry object_ = _dataGridViewDataSource[e.RowIndex].Object; if (object_.LoadException == null) { e.CellStyle.BackColor = _correctColor; e.CellStyle.SelectionBackColor = e.CellStyle.SelectionBackColor.MixWith(_correctColor, 0.4); } else { e.CellStyle.BackColor = _wrongColor; e.CellStyle.SelectionBackColor = e.CellStyle.SelectionBackColor.MixWith(_wrongColor, 0.4); } } else if (dataGridView.Columns[e.ColumnIndex].Name == pathColumn.Name) { ImportedGeometry object_ = _dataGridViewDataSource[e.RowIndex].Object; string absolutePath = LevelSettings.MakeAbsolute(object_.Info.Path); dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].ToolTipText = absolutePath; } }
protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); switch (e.Button) { case MouseButtons.Left: LevelSettings settings = _editor?.Level?.Settings; if (settings != null && settings.ImportedGeometries.All(geo => geo.LoadException != null)) { ImportedGeometry geoToUpdate = settings.ImportedGeometries.FirstOrDefault(geo => geo.LoadException != null); if (geoToUpdate != null) { EditorActions.UpdateImportedGeometryFilePath(Parent, settings, geoToUpdate, true); } else { EditorActions.AddImportedGeometry(Parent); } } else if (CurrentObject != null) { DoDragDrop(CurrentObject, DragDropEffects.Copy); } break; } }
private void UpdateCurrentModelDisplay() { ImportedGeometry currentModelObj = NewLevelSettings.ImportedGeometryFromID(_currentModel); if (currentModelObj == null) { importedGeometryLabel.Text = "None"; } else { importedGeometryLabel.Text = currentModelObj.Info.Name + " (" + currentModelObj.Info.Path + ")"; } }
protected override void OnPaint(PaintEventArgs e) { LevelSettings settings = _editor?.Level?.Settings; if (settings == null) { return; } if (settings.ImportedGeometries.All(geo => geo.LoadException != null)) { ImportedGeometry errorGeo = settings.ImportedGeometries.FirstOrDefault(geo => geo.LoadException != null); string notifyMessage; if (errorGeo == null) { notifyMessage = "Click here to load new imported geometry."; } else { string filePath = settings.MakeAbsolute(errorGeo.Info.Path); string fileName = PathC.GetFileNameWithoutExtensionTry(filePath) ?? ""; if (PathC.IsFileNotFoundException(errorGeo.LoadException)) { notifyMessage = "Geometry file '" + fileName + "' was not found!\n"; } else { notifyMessage = "Unable to load geometry from file '" + fileName + "'.\n"; } notifyMessage += "Click here to choose a replacement.\n\n"; notifyMessage += "Path: " + (filePath ?? ""); } e.Graphics.Clear(Parent.BackColor); using (var b = new SolidBrush(Colors.DisabledText)) e.Graphics.DrawString(notifyMessage, Font, b, ClientRectangle, new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }); ControlPaint.DrawBorder(e.Graphics, ClientRectangle, Colors.GreySelection, ButtonBorderStyle.Solid); } else { base.OnPaint(e); } }
private void AddGeometryFileNodes(LevelSettings settings) { for (int i = 0; i < settings.ImportedGeometries.Count; i++) { ImportedGeometry geometry = settings.ImportedGeometries[i]; string geometryFilePath = GetFullFilePath(geometry.Info.Path, settings); if (!File.Exists(geometryFilePath)) { continue; } DarkTreeNode node = new DarkTreeNode { Icon = Properties.Resources.obj_file.ToBitmap(), Text = geometryFilePath, }; treeView_Resources.Nodes[2].Nodes.Add(node); treeView_Resources.Nodes[2].Expanded = true; } }
public ImportedGeometryWrapper(ImportedGeometryManager parent, ImportedGeometry object_) { _parent = parent; Object = object_; }