mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-31 04:40:55 +00:00
grid and background image
This commit is contained in:
parent
8579667b82
commit
f0056b9745
34 changed files with 1914 additions and 274 deletions
BIN
Resources/Icons/Grid.png
Normal file
BIN
Resources/Icons/Grid.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 173 B |
BIN
Resources/Icons/Grid2.png
Normal file
BIN
Resources/Icons/Grid2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 173 B |
|
@ -61,6 +61,7 @@
|
|||
<Compile Include="Data\TextureImage.cs" />
|
||||
<Compile Include="Editing\DragVerticesMode.cs" />
|
||||
<Compile Include="Editing\EditMode.cs" />
|
||||
<Compile Include="Editing\GridSetup.cs" />
|
||||
<Compile Include="Editing\LinedefsMode.cs" />
|
||||
<Compile Include="Editing\SectorsMode.cs" />
|
||||
<Compile Include="Editing\ThingsMode.cs" />
|
||||
|
@ -103,9 +104,21 @@
|
|||
<Compile Include="Interface\ConfigForm.Designer.cs">
|
||||
<DependentUpon>ConfigForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Interface\FlatBrowserForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Interface\FlatBrowserForm.Designer.cs">
|
||||
<DependentUpon>FlatBrowserForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Interface\DelayedForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Interface\GridSetupForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Interface\GridSetupForm.Designer.cs">
|
||||
<DependentUpon>GridSetupForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Interface\ImageBrowser.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
|
@ -268,6 +281,7 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\Builder.ico" />
|
||||
<None Include="Resources\Grid2.png" />
|
||||
<None Include="Resources\Hourglass.png" />
|
||||
<None Include="Resources\Filter.png" />
|
||||
<None Include="Resources\ThingsMode.png" />
|
||||
|
@ -296,10 +310,18 @@
|
|||
<SubType>Designer</SubType>
|
||||
<DependentUpon>ConfigForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Interface\FlatBrowserForm.resx">
|
||||
<DependentUpon>FlatBrowserForm.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Interface\DelayedForm.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<DependentUpon>DelayedForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Interface\GridSetupForm.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<DependentUpon>GridSetupForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Interface\ImageBrowser.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<DependentUpon>ImageBrowser.cs</DependentUpon>
|
||||
|
|
|
@ -29,33 +29,6 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
{
|
||||
public class Action
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
public const string NEWMAP = "newmap";
|
||||
public const string OPENMAP = "openmap";
|
||||
public const string CLOSEMAP = "closemap";
|
||||
public const string SAVEMAP = "savemap";
|
||||
public const string SAVEMAPAS = "savemapas";
|
||||
public const string SHOWOVERVIEW = "showoverview";
|
||||
public const string SCROLLNORTH = "scrollnorth";
|
||||
public const string SCROLLSOUTH = "scrollsouth";
|
||||
public const string SCROLLWEST = "scrollwest";
|
||||
public const string SCROLLEAST = "scrolleast";
|
||||
public const string ZOOMIN = "zoomin";
|
||||
public const string ZOOMOUT = "zoomout";
|
||||
public const string CONFIGURATION = "configuration";
|
||||
public const string PREFERENCES = "preferences";
|
||||
public const string MAPOPTIONS = "mapoptions";
|
||||
public const string RELOADRESOURCES = "reloadresources";
|
||||
public const string VERTICESMODE = "verticesmode";
|
||||
public const string LINEDEFSMODE = "linedefsmode";
|
||||
public const string SECTORSMODE = "sectorsmode";
|
||||
public const string THINGSMODE = "thingsmode";
|
||||
public const string TESTACTION = "testaction";
|
||||
public const string CANCELMODE = "cancelmode";
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Variables
|
||||
|
||||
// Description
|
||||
|
|
|
@ -90,7 +90,10 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
del = (ActionDelegate)Delegate.CreateDelegate(typeof(ActionDelegate), obj, m);
|
||||
|
||||
// Bind method to action
|
||||
General.Actions[a.action].Bind(del);
|
||||
if(General.Actions.Exists(a.action))
|
||||
General.Actions[a.action].Bind(del);
|
||||
else
|
||||
throw new ArgumentException("Could not bind " + m.ReflectedType.Name + "." + m.Name + " to action \"" + a.action + "\", that action does not exist! Refer to, or edit Actions.cfg for all available application actions.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,11 @@ namespace CodeImp.DoomBuilder.Data
|
|||
{
|
||||
// Load file
|
||||
bitmap = (Bitmap)Bitmap.FromFile(filepathname);
|
||||
|
||||
|
||||
// Get width and height from image
|
||||
width = bitmap.Size.Width;
|
||||
height = bitmap.Size.Height;
|
||||
|
||||
// Pass on to base
|
||||
base.LoadImage();
|
||||
}
|
||||
|
|
|
@ -61,6 +61,10 @@ namespace CodeImp.DoomBuilder.Data
|
|||
// Read data as bitmap
|
||||
mem.Seek(0, SeekOrigin.Begin);
|
||||
bitmap = reader.ReadAsBitmap(mem);
|
||||
|
||||
// Get width and height from image
|
||||
width = bitmap.Size.Width;
|
||||
height = bitmap.Size.Height;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -110,7 +110,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
#endregion
|
||||
|
||||
#region ================== Management
|
||||
|
||||
|
||||
// This sets the name
|
||||
protected void SetName(string name)
|
||||
{
|
||||
|
|
|
@ -61,6 +61,10 @@ namespace CodeImp.DoomBuilder.Data
|
|||
// Read data as bitmap
|
||||
mem.Seek(0, SeekOrigin.Begin);
|
||||
bitmap = reader.ReadAsBitmap(mem);
|
||||
|
||||
// Get width and height from image
|
||||
width = bitmap.Size.Width;
|
||||
height = bitmap.Size.Height;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
protected Vector2D mousedownmappos;
|
||||
protected MouseButtons mousebuttons;
|
||||
protected bool mouseinside;
|
||||
protected bool mousedragging;
|
||||
protected MouseButtons mousedragging = MouseButtons.None;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -95,7 +95,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
#region ================== Scroll / Zoom
|
||||
|
||||
// This scrolls the view north
|
||||
[Action(Action.SCROLLNORTH)]
|
||||
[Action("scrollnorth")]
|
||||
public virtual void ScrollNorth()
|
||||
{
|
||||
// Scroll
|
||||
|
@ -103,7 +103,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
}
|
||||
|
||||
// This scrolls the view south
|
||||
[Action(Action.SCROLLSOUTH)]
|
||||
[Action("scrollsouth")]
|
||||
public virtual void ScrollSouth()
|
||||
{
|
||||
// Scroll
|
||||
|
@ -111,7 +111,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
}
|
||||
|
||||
// This scrolls the view west
|
||||
[Action(Action.SCROLLWEST)]
|
||||
[Action("scrollwest")]
|
||||
public virtual void ScrollWest()
|
||||
{
|
||||
// Scroll
|
||||
|
@ -119,7 +119,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
}
|
||||
|
||||
// This scrolls the view east
|
||||
[Action(Action.SCROLLEAST)]
|
||||
[Action("scrolleast")]
|
||||
public virtual void ScrollEast()
|
||||
{
|
||||
// Scroll
|
||||
|
@ -127,7 +127,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
}
|
||||
|
||||
// This zooms in
|
||||
[Action(Action.ZOOMIN)]
|
||||
[Action("zoomin")]
|
||||
public virtual void ZoomIn()
|
||||
{
|
||||
// Zoom
|
||||
|
@ -135,7 +135,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
}
|
||||
|
||||
// This zooms out
|
||||
[Action(Action.ZOOMOUT)]
|
||||
[Action("zoomout")]
|
||||
public virtual void ZoomOut()
|
||||
{
|
||||
// Zoom
|
||||
|
@ -281,11 +281,12 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
// Update labels in main window
|
||||
General.MainWindow.UpdateCoordinates(mousemappos);
|
||||
|
||||
// Holding any buttons?
|
||||
if(e.Button != MouseButtons.None)
|
||||
// Holding a button?
|
||||
if((e.Button == EditMode.EDIT_BUTTON) ||
|
||||
(e.Button == EditMode.SELECT_BUTTON))
|
||||
{
|
||||
// Not dragging?
|
||||
if(!mousedragging)
|
||||
if(mousedragging == MouseButtons.None)
|
||||
{
|
||||
// Check if moved enough pixels for dragging
|
||||
delta = mousedownpos - mousepos;
|
||||
|
@ -293,7 +294,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
(Math.Abs(delta.y) > DRAG_START_MOVE_PIXELS))
|
||||
{
|
||||
// Dragging starts now
|
||||
mousedragging = true;
|
||||
mousedragging = e.Button;
|
||||
DragStart(e);
|
||||
}
|
||||
}
|
||||
|
@ -314,10 +315,31 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
base.MouseDown(e);
|
||||
}
|
||||
|
||||
// Mouse button released
|
||||
public override void MouseUp(MouseEventArgs e)
|
||||
{
|
||||
// Releasing drag button?
|
||||
if(e.Button == mousedragging)
|
||||
{
|
||||
// No longer dragging
|
||||
mousedragging = MouseButtons.None;
|
||||
DragStop(e);
|
||||
}
|
||||
|
||||
// Let the base class know
|
||||
base.MouseUp(e);
|
||||
}
|
||||
|
||||
// This is called when the mouse is moved enough pixels and holding one or more buttons
|
||||
protected virtual void DragStart(MouseEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// This is called when a drag is ended because the mouse buton is released
|
||||
protected virtual void DragStop(MouseEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -335,7 +357,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
#region ================== Methods
|
||||
|
||||
// Override cancel method to bind it with its action
|
||||
[Action(Action.CANCELMODE)]
|
||||
[Action("cancelmode")]
|
||||
public override void Cancel()
|
||||
{
|
||||
cancelled = true;
|
||||
|
|
|
@ -38,7 +38,7 @@ using CodeImp.DoomBuilder.Geometry;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Editing
|
||||
{
|
||||
public class DragVerticesMode : VerticesMode
|
||||
public class DragVerticesMode : ClassicMode
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
@ -46,12 +46,15 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
|
||||
#region ================== Variables
|
||||
|
||||
// Mouse offset from dragitem
|
||||
protected Vector2D dragoffset;
|
||||
// Mouse position on map where dragging started
|
||||
protected Vector2D dragstartmappos;
|
||||
|
||||
// Item used as reference for dragging
|
||||
// Item used as reference for snapping to the grid
|
||||
protected Vertex dragitem;
|
||||
|
||||
// List of old vertex positions
|
||||
protected List<Vector2D> oldpositions;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
@ -61,12 +64,17 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor to start dragging immediately
|
||||
public DragVerticesMode(Vertex dragitem, Vector2D dragoffset)
|
||||
public DragVerticesMode(Vertex dragitem, Vector2D dragstartmappos)
|
||||
{
|
||||
// Initialize
|
||||
this.dragitem = dragitem;
|
||||
this.dragoffset = dragoffset;
|
||||
this.dragstartmappos = dragstartmappos;
|
||||
|
||||
// Make old positions list
|
||||
// We will use this as reference to move the vertices, or to move them back on cancel
|
||||
oldpositions = new List<Vector2D>(General.Map.Selection.Vertices.Count);
|
||||
foreach(Vertex v in General.Map.Selection.Vertices) oldpositions.Add(v.Position);
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
@ -91,15 +99,42 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
// Cancelled
|
||||
public override void Cancel()
|
||||
{
|
||||
// Move geometry back to original position
|
||||
int i = 0;
|
||||
|
||||
// Continue cancelling
|
||||
// Move geometry back to original position
|
||||
foreach(Vertex v in General.Map.Selection.Vertices)
|
||||
{
|
||||
// Move vertex back to original position
|
||||
v.Move(oldpositions[i]);
|
||||
|
||||
// Next
|
||||
i++;
|
||||
}
|
||||
|
||||
// Update cached values
|
||||
General.Map.Map.Update();
|
||||
|
||||
// Cancel base class
|
||||
base.Cancel();
|
||||
|
||||
// Return to vertices mode
|
||||
General.Map.ChangeMode(new VerticesMode());
|
||||
}
|
||||
|
||||
// Mode engages
|
||||
public override void Engage()
|
||||
{
|
||||
base.Engage();
|
||||
|
||||
// Check vertices button on main window
|
||||
General.MainWindow.SetVerticesChecked(true);
|
||||
}
|
||||
|
||||
// Disenagaging
|
||||
public override void Disengage()
|
||||
{
|
||||
base.Disengage();
|
||||
|
||||
// When not cancelled
|
||||
if(!cancelled)
|
||||
{
|
||||
|
@ -110,28 +145,62 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
// Map is changed
|
||||
General.Map.IsChanged = true;
|
||||
}
|
||||
|
||||
// Continue disengage
|
||||
base.Disengage();
|
||||
|
||||
// Hide highlight info
|
||||
General.MainWindow.HideInfo();
|
||||
|
||||
// Uncheck vertices button on main window
|
||||
General.MainWindow.SetVerticesChecked(false);
|
||||
}
|
||||
|
||||
// Mouse button pressed
|
||||
public override void MouseDown(MouseEventArgs e)
|
||||
// This redraws the display
|
||||
public unsafe override void RedrawDisplay()
|
||||
{
|
||||
// Do nothing.
|
||||
// Start with a clear display
|
||||
if(renderer.StartRendering(true, true))
|
||||
{
|
||||
// Render things
|
||||
renderer.SetThingsRenderOrder(false);
|
||||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
|
||||
// Render lines and vertices
|
||||
renderer.RenderLinedefSet(General.Map.Map.Linedefs);
|
||||
renderer.RenderVerticesSet(General.Map.Map.Vertices);
|
||||
|
||||
// Done
|
||||
renderer.FinishRendering();
|
||||
}
|
||||
}
|
||||
|
||||
// Mouse moving
|
||||
public override void MouseMove(MouseEventArgs e)
|
||||
{
|
||||
|
||||
// TODO: Move selected geometry and redraw
|
||||
|
||||
int i = 0;
|
||||
|
||||
base.MouseMove(e);
|
||||
|
||||
// Move selected geometry
|
||||
foreach(Vertex v in General.Map.Selection.Vertices)
|
||||
{
|
||||
// Move vertex from old position relative to the mouse position change since drag start
|
||||
v.Move(oldpositions[i] + (mousemappos - dragstartmappos));
|
||||
|
||||
// Next
|
||||
i++;
|
||||
}
|
||||
|
||||
// Update cached values
|
||||
General.Map.Map.Update();
|
||||
|
||||
// Redraw
|
||||
General.MainWindow.RedrawDisplay();
|
||||
}
|
||||
|
||||
// Mosue button released
|
||||
public override void MouseUp(MouseEventArgs e)
|
||||
{
|
||||
base.MouseUp(e);
|
||||
|
||||
// Is the editing button released?
|
||||
if(e.Button == EditMode.EDIT_BUTTON)
|
||||
{
|
||||
|
@ -139,12 +208,6 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
General.Map.ChangeMode(new VerticesMode());
|
||||
}
|
||||
}
|
||||
|
||||
// When dragging starts
|
||||
protected override void DragStart(MouseEventArgs e)
|
||||
{
|
||||
// Do nothing. We're already dragging.
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
134
Source/Editing/GridSetup.cs
Normal file
134
Source/Editing/GridSetup.cs
Normal file
|
@ -0,0 +1,134 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using CodeImp.DoomBuilder.Data;
|
||||
using SlimDX.Direct3D9;
|
||||
using CodeImp.DoomBuilder.Geometry;
|
||||
|
||||
namespace CodeImp.DoomBuilder.Editing
|
||||
{
|
||||
public class GridSetup
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
private const int DEFAULT_GRID_SIZE = 32;
|
||||
|
||||
public const int SOURCE_TEXTURES = 0;
|
||||
public const int SOURCE_FLATS = 1;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Variables
|
||||
|
||||
// Grid
|
||||
private int gridsize;
|
||||
private float gridsizef;
|
||||
private float gridsizefinv;
|
||||
|
||||
// Background
|
||||
private string background = "";
|
||||
private int backsource;
|
||||
private ImageData backimage = new NullImage();
|
||||
private int backoffsetx, backoffsety;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
||||
public int GridSize { get { return gridsize; } }
|
||||
public float GridSizeF { get { return gridsizef; } }
|
||||
public string BackgroundName { get { return background; } }
|
||||
public int BackgroundSource { get { return backsource; } }
|
||||
public ImageData Background { get { return backimage; } }
|
||||
public int BackgroundX { get { return backoffsetx; } }
|
||||
public int BackgroundY { get { return backoffsety; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public GridSetup()
|
||||
{
|
||||
// Initialize
|
||||
SetGridSize(DEFAULT_GRID_SIZE);
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
|
||||
// This sets the grid size
|
||||
public void SetGridSize(int size)
|
||||
{
|
||||
// Change grid
|
||||
this.gridsize = size;
|
||||
this.gridsizef = (float)gridsize;
|
||||
this.gridsizefinv = 1f / gridsizef;
|
||||
|
||||
// Update in main window
|
||||
General.MainWindow.UpdateGrid(gridsize);
|
||||
}
|
||||
|
||||
// This sets the background
|
||||
public void SetBackground(string name, int source)
|
||||
{
|
||||
// Set background
|
||||
if(name == null) name = "";
|
||||
this.backsource = source;
|
||||
this.background = name;
|
||||
|
||||
// Find this image
|
||||
LinkBackground();
|
||||
}
|
||||
|
||||
// This sets the background offset
|
||||
public void SetBackgroundOffset(int offsetx, int offsety)
|
||||
{
|
||||
// Set background offset
|
||||
this.backoffsetx = offsetx;
|
||||
this.backoffsety = offsety;
|
||||
}
|
||||
|
||||
// This finds and links the background image
|
||||
public void LinkBackground()
|
||||
{
|
||||
// From textures?
|
||||
if(backsource == SOURCE_TEXTURES)
|
||||
{
|
||||
// Get this texture
|
||||
backimage = General.Map.Data.GetTextureImage(background);
|
||||
}
|
||||
// From flats?
|
||||
else if(backsource == SOURCE_FLATS)
|
||||
{
|
||||
// Get this flat
|
||||
backimage = General.Map.Data.GetFlatImage(background);
|
||||
}
|
||||
|
||||
// Make sure it is loaded
|
||||
backimage.LoadImage();
|
||||
backimage.CreateTexture();
|
||||
}
|
||||
|
||||
// This snaps to the nearest grid coordinate
|
||||
public Vector2D SnappedToGrid(Vector2D v)
|
||||
{
|
||||
return GridSetup.SnappedToGrid(v, gridsizef, gridsizefinv);
|
||||
}
|
||||
|
||||
// This snaps to the nearest grid coordinate
|
||||
public static Vector2D SnappedToGrid(Vector2D v, float gridsize, float gridsizeinv)
|
||||
{
|
||||
return new Vector2D((float)Math.Round(v.x * gridsizeinv) * gridsize,
|
||||
(float)Math.Round(v.y * gridsizeinv) * gridsize);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -258,7 +258,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
}
|
||||
|
||||
// Start dragging the selection
|
||||
General.Map.ChangeMode(new DragVerticesMode(highlighted, mousedownmappos - highlighted.Position));
|
||||
General.Map.ChangeMode(new DragVerticesMode(highlighted, mousedownmappos));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -561,7 +561,7 @@ namespace CodeImp.DoomBuilder
|
|||
#region ================== Management
|
||||
|
||||
// This creates a new map
|
||||
[Action(Action.NEWMAP)]
|
||||
[Action("newmap")]
|
||||
public static void NewMap()
|
||||
{
|
||||
MapOptions newoptions = new MapOptions();
|
||||
|
@ -609,7 +609,7 @@ namespace CodeImp.DoomBuilder
|
|||
}
|
||||
|
||||
// This closes the current map
|
||||
[Action(Action.CLOSEMAP)]
|
||||
[Action("closemap")]
|
||||
public static void CloseMap()
|
||||
{
|
||||
// Ask the user to save changes (if any)
|
||||
|
@ -636,7 +636,7 @@ namespace CodeImp.DoomBuilder
|
|||
}
|
||||
|
||||
// This loads a map from file
|
||||
[Action(Action.OPENMAP)]
|
||||
[Action("openmap")]
|
||||
public static void OpenMap()
|
||||
{
|
||||
OpenFileDialog openfile;
|
||||
|
@ -707,7 +707,7 @@ namespace CodeImp.DoomBuilder
|
|||
}
|
||||
|
||||
// This saves the current map
|
||||
[Action(Action.SAVEMAP)]
|
||||
[Action("savemap")]
|
||||
public static void SaveMap()
|
||||
{
|
||||
// Check if a wad file is known
|
||||
|
@ -737,7 +737,7 @@ namespace CodeImp.DoomBuilder
|
|||
}
|
||||
|
||||
// This saves the current map as a different file
|
||||
[Action(Action.SAVEMAPAS)]
|
||||
[Action("savemapas")]
|
||||
public static void SaveMapAs()
|
||||
{
|
||||
SaveFileDialog savefile;
|
||||
|
@ -1014,7 +1014,7 @@ namespace CodeImp.DoomBuilder
|
|||
|
||||
#endregion
|
||||
|
||||
[Action(Action.TESTACTION)]
|
||||
[Action("testaction")]
|
||||
public static void TestAction()
|
||||
{
|
||||
TextureBrowserForm t = new TextureBrowserForm();
|
||||
|
|
|
@ -76,6 +76,7 @@ namespace CodeImp.DoomBuilder
|
|||
private Renderer3D renderer3d;
|
||||
private WAD tempwad;
|
||||
private MapSelection selection;
|
||||
private GridSetup grid;
|
||||
|
||||
// Disposing
|
||||
private bool isdisposed = false;
|
||||
|
@ -98,6 +99,7 @@ namespace CodeImp.DoomBuilder
|
|||
public Renderer3D Renderer3D { get { return renderer3d; } }
|
||||
public GameConfiguration Config { get { return config; } }
|
||||
public MapSelection Selection { get { return selection; } }
|
||||
public GridSetup Grid { get { return grid; } }
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -110,6 +112,7 @@ namespace CodeImp.DoomBuilder
|
|||
GC.SuppressFinalize(this);
|
||||
|
||||
// Basic objects
|
||||
grid = new GridSetup();
|
||||
selection = new MapSelection();
|
||||
}
|
||||
|
||||
|
@ -848,7 +851,7 @@ namespace CodeImp.DoomBuilder
|
|||
}
|
||||
|
||||
// This switches to vertices mode
|
||||
[Action(Action.VERTICESMODE)]
|
||||
[Action("verticesmode")]
|
||||
public void SwitchVerticesMode()
|
||||
{
|
||||
// Change to vertices mode
|
||||
|
@ -856,7 +859,7 @@ namespace CodeImp.DoomBuilder
|
|||
}
|
||||
|
||||
// This switches to linedefs mode
|
||||
[Action(Action.LINEDEFSMODE)]
|
||||
[Action("linedefsmode")]
|
||||
public void SwitchLinedefsMode()
|
||||
{
|
||||
// Change to linedefs mode
|
||||
|
@ -864,7 +867,7 @@ namespace CodeImp.DoomBuilder
|
|||
}
|
||||
|
||||
// This switches to sectors mode
|
||||
[Action(Action.SECTORSMODE)]
|
||||
[Action("sectorsmode")]
|
||||
public void SwitchSectorsMode()
|
||||
{
|
||||
// Change to sectors mode
|
||||
|
@ -872,7 +875,7 @@ namespace CodeImp.DoomBuilder
|
|||
}
|
||||
|
||||
// This switches to things mode
|
||||
[Action(Action.THINGSMODE)]
|
||||
[Action("thingsmode")]
|
||||
public void SwitchThingsMode()
|
||||
{
|
||||
// Change to things mode
|
||||
|
@ -884,7 +887,7 @@ namespace CodeImp.DoomBuilder
|
|||
#region ================== Methods
|
||||
|
||||
// This reloads resources
|
||||
[Action(Action.RELOADRESOURCES)]
|
||||
[Action("reloadresources")]
|
||||
public void ReloadResources()
|
||||
{
|
||||
DataLocation maplocation;
|
||||
|
@ -919,6 +922,9 @@ namespace CodeImp.DoomBuilder
|
|||
|
||||
// Apply new settings to map elements
|
||||
map.UpdateConfiguration();
|
||||
|
||||
// Re-link the background image
|
||||
grid.LinkBackground();
|
||||
|
||||
// Reset status
|
||||
General.MainWindow.DisplayStatus(oldstatus);
|
||||
|
@ -926,7 +932,7 @@ namespace CodeImp.DoomBuilder
|
|||
}
|
||||
|
||||
// Game Configuration action
|
||||
[Action(Action.MAPOPTIONS)]
|
||||
[Action("mapoptions")]
|
||||
public void ShowMapOptions()
|
||||
{
|
||||
// Show map options dialog
|
||||
|
|
103
Source/Interface/FlatBrowserForm.Designer.cs
generated
Normal file
103
Source/Interface/FlatBrowserForm.Designer.cs
generated
Normal file
|
@ -0,0 +1,103 @@
|
|||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
partial class FlatBrowserForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if(disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.browser = new CodeImp.DoomBuilder.Interface.ImageBrowser();
|
||||
this.cancel = new System.Windows.Forms.Button();
|
||||
this.apply = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// browser
|
||||
//
|
||||
this.browser.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.browser.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.browser.LabelText = "Select or enter a flat name:";
|
||||
this.browser.Location = new System.Drawing.Point(11, 9);
|
||||
this.browser.Name = "browser";
|
||||
this.browser.Size = new System.Drawing.Size(689, 457);
|
||||
this.browser.TabIndex = 0;
|
||||
this.browser.SelectedItemChanged += new CodeImp.DoomBuilder.Interface.ImageBrowser.SelectedItemChangedDelegate(this.browser_SelectedItemChanged);
|
||||
//
|
||||
// cancel
|
||||
//
|
||||
this.cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancel.Location = new System.Drawing.Point(588, 443);
|
||||
this.cancel.Name = "cancel";
|
||||
this.cancel.Size = new System.Drawing.Size(112, 25);
|
||||
this.cancel.TabIndex = 22;
|
||||
this.cancel.Text = "Cancel";
|
||||
this.cancel.UseVisualStyleBackColor = true;
|
||||
this.cancel.Click += new System.EventHandler(this.cancel_Click);
|
||||
//
|
||||
// apply
|
||||
//
|
||||
this.apply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.apply.Location = new System.Drawing.Point(470, 443);
|
||||
this.apply.Name = "apply";
|
||||
this.apply.Size = new System.Drawing.Size(112, 25);
|
||||
this.apply.TabIndex = 21;
|
||||
this.apply.Text = "OK";
|
||||
this.apply.UseVisualStyleBackColor = true;
|
||||
this.apply.Click += new System.EventHandler(this.apply_Click);
|
||||
//
|
||||
// FlatBrowserForm
|
||||
//
|
||||
this.AcceptButton = this.apply;
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.CancelButton = this.cancel;
|
||||
this.ClientSize = new System.Drawing.Size(712, 478);
|
||||
this.Controls.Add(this.cancel);
|
||||
this.Controls.Add(this.apply);
|
||||
this.Controls.Add(this.browser);
|
||||
this.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "FlatBrowserForm";
|
||||
this.Opacity = 0;
|
||||
this.ShowIcon = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Browse Flats";
|
||||
this.Activated += new System.EventHandler(this.FlatBrowserForm_Activated);
|
||||
this.Move += new System.EventHandler(this.FlatBrowserForm_Move);
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FlatBrowserForm_FormClosing);
|
||||
this.ResizeEnd += new System.EventHandler(this.FlatBrowserForm_ResizeEnd);
|
||||
this.Load += new System.EventHandler(this.FlatBrowserForm_Load);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private ImageBrowser browser;
|
||||
private System.Windows.Forms.Button cancel;
|
||||
private System.Windows.Forms.Button apply;
|
||||
}
|
||||
}
|
221
Source/Interface/FlatBrowserForm.cs
Normal file
221
Source/Interface/FlatBrowserForm.cs
Normal file
|
@ -0,0 +1,221 @@
|
|||
|
||||
#region ================== Copyright (c) 2007 Pascal vd Heiden
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
|
||||
* This program is released under GNU General Public License
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Namespaces
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Microsoft.Win32;
|
||||
using System.Diagnostics;
|
||||
using CodeImp.DoomBuilder.Controls;
|
||||
using CodeImp.DoomBuilder.Data;
|
||||
using CodeImp.DoomBuilder.Config;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public partial class FlatBrowserForm : DelayedForm
|
||||
{
|
||||
// Variables
|
||||
private string selectedname;
|
||||
private Point lastposition;
|
||||
private Size lastsize;
|
||||
|
||||
// Properties
|
||||
public string SelectedName { get { return selectedname; } }
|
||||
|
||||
// Constructor
|
||||
public FlatBrowserForm()
|
||||
{
|
||||
Dictionary<long, long> useditems = new Dictionary<long,long>();
|
||||
|
||||
// Initialize
|
||||
InitializeComponent();
|
||||
browser.ApplyColorSettings();
|
||||
|
||||
// Make groups
|
||||
ListViewGroup used = browser.AddGroup("Used Flats");
|
||||
ListViewGroup avail = browser.AddGroup("Available Flats");
|
||||
|
||||
// Go through the map to find the used flats
|
||||
foreach(Sector s in General.Map.Map.Sectors)
|
||||
{
|
||||
// Add floor flat
|
||||
if(!useditems.ContainsKey(s.LongFloorTexture)) useditems.Add(s.LongFloorTexture, 0);
|
||||
|
||||
// Add ceiling flat
|
||||
if(!useditems.ContainsKey(s.LongCeilTexture)) useditems.Add(s.LongCeilTexture, 0);
|
||||
}
|
||||
|
||||
// When mixing textures with flats, include textures as well
|
||||
if(General.Map.Config.MixTexturesFlats)
|
||||
{
|
||||
// Go through the map to find the used textures
|
||||
foreach(Sidedef sd in General.Map.Map.Sidedefs)
|
||||
{
|
||||
// Add high texture
|
||||
if(sd.HighTexture.Length > 0)
|
||||
if(!useditems.ContainsKey(sd.LongHighTexture)) useditems.Add(sd.LongHighTexture, 0);
|
||||
|
||||
// Add mid texture
|
||||
if(sd.LowTexture.Length > 0)
|
||||
if(!useditems.ContainsKey(sd.LongMiddleTexture)) useditems.Add(sd.LongMiddleTexture, 0);
|
||||
|
||||
// Add low texture
|
||||
if(sd.MiddleTexture.Length > 0)
|
||||
if(!useditems.ContainsKey(sd.LongLowTexture)) useditems.Add(sd.LongLowTexture, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// Start adding
|
||||
browser.BeginAdding();
|
||||
|
||||
// Add all used flats
|
||||
foreach(ImageData img in General.Map.Data.Flats)
|
||||
if(useditems.ContainsKey(img.LongName))
|
||||
browser.Add(img.Name, img, img, used);
|
||||
|
||||
// Add all available flats
|
||||
foreach(ImageData img in General.Map.Data.Flats)
|
||||
browser.Add(img.Name, img, img, avail);
|
||||
|
||||
// Done adding
|
||||
browser.EndAdding();
|
||||
|
||||
// Keep last position and size
|
||||
lastposition = this.Location;
|
||||
lastsize = this.Size;
|
||||
}
|
||||
|
||||
// Selection changed
|
||||
private void browser_SelectedItemChanged()
|
||||
{
|
||||
apply.Enabled = (browser.SelectedItem != null);
|
||||
}
|
||||
|
||||
// OK clicked
|
||||
private void apply_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Set selected name and close
|
||||
selectedname = browser.SelectedItem.Text;
|
||||
DialogResult = DialogResult.OK;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
// Cancel clicked
|
||||
private void cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
// No selection, close
|
||||
selectedname = "";
|
||||
DialogResult = DialogResult.Cancel;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
// Activated
|
||||
private void FlatBrowserForm_Activated(object sender, EventArgs e)
|
||||
{
|
||||
// Focus the textbox
|
||||
browser.FocusTextbox();
|
||||
}
|
||||
|
||||
// Loading
|
||||
private void FlatBrowserForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
// Position window from configuration settings
|
||||
this.SuspendLayout();
|
||||
this.Location = new Point(General.Settings.ReadSetting("browserwindow.positionx", this.Location.X),
|
||||
General.Settings.ReadSetting("browserwindow.positiony", this.Location.Y));
|
||||
this.Size = new Size(General.Settings.ReadSetting("browserwindow.sizewidth", this.Size.Width),
|
||||
General.Settings.ReadSetting("browserwindow.sizeheight", this.Size.Height));
|
||||
this.WindowState = (FormWindowState)General.Settings.ReadSetting("browserwindow.windowstate", (int)FormWindowState.Normal);
|
||||
this.ResumeLayout(true);
|
||||
|
||||
// Normal windowstate?
|
||||
if(this.WindowState == FormWindowState.Normal)
|
||||
{
|
||||
// Keep last position and size
|
||||
lastposition = this.Location;
|
||||
lastsize = this.Size;
|
||||
}
|
||||
}
|
||||
|
||||
// Resized
|
||||
private void FlatBrowserForm_ResizeEnd(object sender, EventArgs e)
|
||||
{
|
||||
// Normal windowstate?
|
||||
if(this.WindowState == FormWindowState.Normal)
|
||||
{
|
||||
// Keep last position and size
|
||||
lastposition = this.Location;
|
||||
lastsize = this.Size;
|
||||
}
|
||||
}
|
||||
|
||||
// Moved
|
||||
private void FlatBrowserForm_Move(object sender, EventArgs e)
|
||||
{
|
||||
// Normal windowstate?
|
||||
if(this.WindowState == FormWindowState.Normal)
|
||||
{
|
||||
// Keep last position and size
|
||||
lastposition = this.Location;
|
||||
lastsize = this.Size;
|
||||
}
|
||||
}
|
||||
|
||||
// Closing
|
||||
private void FlatBrowserForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
int windowstate;
|
||||
|
||||
// Determine window state to save
|
||||
if(this.WindowState != FormWindowState.Minimized)
|
||||
windowstate = (int)this.WindowState;
|
||||
else
|
||||
windowstate = (int)FormWindowState.Normal;
|
||||
|
||||
// Save window settings
|
||||
General.Settings.WriteSetting("browserwindow.positionx", lastposition.X);
|
||||
General.Settings.WriteSetting("browserwindow.positiony", lastposition.Y);
|
||||
General.Settings.WriteSetting("browserwindow.sizewidth", lastsize.Width);
|
||||
General.Settings.WriteSetting("browserwindow.sizeheight", lastsize.Height);
|
||||
General.Settings.WriteSetting("browserwindow.windowstate", windowstate);
|
||||
}
|
||||
|
||||
// Static method to browse for flats
|
||||
// Returns null when cancelled.
|
||||
public static string Browse(IWin32Window parent, string select)
|
||||
{
|
||||
FlatBrowserForm browser = new FlatBrowserForm();
|
||||
if(browser.ShowDialog(parent) == DialogResult.OK)
|
||||
{
|
||||
// Return result
|
||||
return browser.SelectedName;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Cancelled
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
132
Source/Interface/FlatBrowserForm.resx
Normal file
132
Source/Interface/FlatBrowserForm.resx
Normal file
|
@ -0,0 +1,132 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="browser.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="cancel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="apply.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
255
Source/Interface/GridSetupForm.Designer.cs
generated
Normal file
255
Source/Interface/GridSetupForm.Designer.cs
generated
Normal file
|
@ -0,0 +1,255 @@
|
|||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
partial class GridSetupForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if(disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.Windows.Forms.GroupBox groupBox1;
|
||||
System.Windows.Forms.Label label1;
|
||||
System.Windows.Forms.GroupBox groupBox2;
|
||||
this.gridsize = new System.Windows.Forms.NumericUpDown();
|
||||
this.showbackground = new System.Windows.Forms.CheckBox();
|
||||
this.backoffsety = new System.Windows.Forms.NumericUpDown();
|
||||
this.backoffsetx = new System.Windows.Forms.NumericUpDown();
|
||||
this.backoffset = new System.Windows.Forms.Label();
|
||||
this.selectflat = new System.Windows.Forms.Button();
|
||||
this.selecttexture = new System.Windows.Forms.Button();
|
||||
this.backgroundimage = new System.Windows.Forms.Panel();
|
||||
this.cancel = new System.Windows.Forms.Button();
|
||||
this.apply = new System.Windows.Forms.Button();
|
||||
groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
label1 = new System.Windows.Forms.Label();
|
||||
groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
groupBox1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.gridsize)).BeginInit();
|
||||
groupBox2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.backoffsety)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.backoffsetx)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
groupBox1.Controls.Add(this.gridsize);
|
||||
groupBox1.Controls.Add(label1);
|
||||
groupBox1.Location = new System.Drawing.Point(12, 12);
|
||||
groupBox1.Name = "groupBox1";
|
||||
groupBox1.Size = new System.Drawing.Size(285, 71);
|
||||
groupBox1.TabIndex = 0;
|
||||
groupBox1.TabStop = false;
|
||||
groupBox1.Text = " Grid ";
|
||||
//
|
||||
// gridsize
|
||||
//
|
||||
this.gridsize.Location = new System.Drawing.Point(146, 28);
|
||||
this.gridsize.Maximum = new decimal(new int[] {
|
||||
4096,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.gridsize.Minimum = new decimal(new int[] {
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.gridsize.Name = "gridsize";
|
||||
this.gridsize.Size = new System.Drawing.Size(79, 20);
|
||||
this.gridsize.TabIndex = 1;
|
||||
this.gridsize.Value = new decimal(new int[] {
|
||||
32,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new System.Drawing.Point(25, 31);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new System.Drawing.Size(115, 14);
|
||||
label1.TabIndex = 0;
|
||||
label1.Text = "Grid size in mappixels:";
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
groupBox2.Controls.Add(this.showbackground);
|
||||
groupBox2.Controls.Add(this.backoffsety);
|
||||
groupBox2.Controls.Add(this.backoffsetx);
|
||||
groupBox2.Controls.Add(this.backoffset);
|
||||
groupBox2.Controls.Add(this.selectflat);
|
||||
groupBox2.Controls.Add(this.selecttexture);
|
||||
groupBox2.Controls.Add(this.backgroundimage);
|
||||
groupBox2.Location = new System.Drawing.Point(12, 89);
|
||||
groupBox2.Name = "groupBox2";
|
||||
groupBox2.Size = new System.Drawing.Size(285, 181);
|
||||
groupBox2.TabIndex = 1;
|
||||
groupBox2.TabStop = false;
|
||||
groupBox2.Text = " Background ";
|
||||
//
|
||||
// showbackground
|
||||
//
|
||||
this.showbackground.AutoSize = true;
|
||||
this.showbackground.Location = new System.Drawing.Point(28, 29);
|
||||
this.showbackground.Name = "showbackground";
|
||||
this.showbackground.Size = new System.Drawing.Size(146, 18);
|
||||
this.showbackground.TabIndex = 7;
|
||||
this.showbackground.Text = "Show background image";
|
||||
this.showbackground.UseVisualStyleBackColor = true;
|
||||
this.showbackground.CheckedChanged += new System.EventHandler(this.showbackground_CheckedChanged);
|
||||
//
|
||||
// backoffsety
|
||||
//
|
||||
this.backoffsety.Enabled = false;
|
||||
this.backoffsety.Location = new System.Drawing.Point(197, 137);
|
||||
this.backoffsety.Maximum = new decimal(new int[] {
|
||||
4096,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.backoffsety.Name = "backoffsety";
|
||||
this.backoffsety.Size = new System.Drawing.Size(57, 20);
|
||||
this.backoffsety.TabIndex = 6;
|
||||
//
|
||||
// backoffsetx
|
||||
//
|
||||
this.backoffsetx.Enabled = false;
|
||||
this.backoffsetx.Location = new System.Drawing.Point(134, 137);
|
||||
this.backoffsetx.Maximum = new decimal(new int[] {
|
||||
4096,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.backoffsetx.Name = "backoffsetx";
|
||||
this.backoffsetx.Size = new System.Drawing.Size(57, 20);
|
||||
this.backoffsetx.TabIndex = 5;
|
||||
//
|
||||
// backoffset
|
||||
//
|
||||
this.backoffset.AutoSize = true;
|
||||
this.backoffset.Enabled = false;
|
||||
this.backoffset.Location = new System.Drawing.Point(25, 140);
|
||||
this.backoffset.Name = "backoffset";
|
||||
this.backoffset.Size = new System.Drawing.Size(103, 14);
|
||||
this.backoffset.TabIndex = 4;
|
||||
this.backoffset.Text = "Offset in mappixels:";
|
||||
//
|
||||
// selectflat
|
||||
//
|
||||
this.selectflat.Enabled = false;
|
||||
this.selectflat.Location = new System.Drawing.Point(92, 91);
|
||||
this.selectflat.Name = "selectflat";
|
||||
this.selectflat.Size = new System.Drawing.Size(117, 25);
|
||||
this.selectflat.TabIndex = 3;
|
||||
this.selectflat.Text = "Select Flat...";
|
||||
this.selectflat.UseVisualStyleBackColor = true;
|
||||
this.selectflat.Click += new System.EventHandler(this.selectflat_Click);
|
||||
//
|
||||
// selecttexture
|
||||
//
|
||||
this.selecttexture.Enabled = false;
|
||||
this.selecttexture.Location = new System.Drawing.Point(92, 60);
|
||||
this.selecttexture.Name = "selecttexture";
|
||||
this.selecttexture.Size = new System.Drawing.Size(117, 25);
|
||||
this.selecttexture.TabIndex = 2;
|
||||
this.selecttexture.Text = "Select Texture...";
|
||||
this.selecttexture.UseVisualStyleBackColor = true;
|
||||
this.selecttexture.Click += new System.EventHandler(this.selecttexture_Click);
|
||||
//
|
||||
// backgroundimage
|
||||
//
|
||||
this.backgroundimage.BackColor = System.Drawing.SystemColors.AppWorkspace;
|
||||
this.backgroundimage.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.backgroundimage.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.backgroundimage.Location = new System.Drawing.Point(28, 60);
|
||||
this.backgroundimage.Name = "backgroundimage";
|
||||
this.backgroundimage.Size = new System.Drawing.Size(58, 56);
|
||||
this.backgroundimage.TabIndex = 1;
|
||||
//
|
||||
// cancel
|
||||
//
|
||||
this.cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancel.Location = new System.Drawing.Point(185, 283);
|
||||
this.cancel.Name = "cancel";
|
||||
this.cancel.Size = new System.Drawing.Size(112, 25);
|
||||
this.cancel.TabIndex = 22;
|
||||
this.cancel.Text = "Cancel";
|
||||
this.cancel.UseVisualStyleBackColor = true;
|
||||
this.cancel.Click += new System.EventHandler(this.cancel_Click);
|
||||
//
|
||||
// apply
|
||||
//
|
||||
this.apply.Location = new System.Drawing.Point(67, 283);
|
||||
this.apply.Name = "apply";
|
||||
this.apply.Size = new System.Drawing.Size(112, 25);
|
||||
this.apply.TabIndex = 21;
|
||||
this.apply.Text = "OK";
|
||||
this.apply.UseVisualStyleBackColor = true;
|
||||
this.apply.Click += new System.EventHandler(this.apply_Click);
|
||||
//
|
||||
// GridSetupForm
|
||||
//
|
||||
this.AcceptButton = this.apply;
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.CancelButton = this.cancel;
|
||||
this.ClientSize = new System.Drawing.Size(309, 318);
|
||||
this.Controls.Add(this.cancel);
|
||||
this.Controls.Add(this.apply);
|
||||
this.Controls.Add(groupBox2);
|
||||
this.Controls.Add(groupBox1);
|
||||
this.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "GridSetupForm";
|
||||
this.Opacity = 0;
|
||||
this.ShowIcon = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Custom Grid Setup";
|
||||
groupBox1.ResumeLayout(false);
|
||||
groupBox1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.gridsize)).EndInit();
|
||||
groupBox2.ResumeLayout(false);
|
||||
groupBox2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.backoffsety)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.backoffsetx)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.NumericUpDown gridsize;
|
||||
private System.Windows.Forms.Panel backgroundimage;
|
||||
private System.Windows.Forms.Button selecttexture;
|
||||
private System.Windows.Forms.Button selectflat;
|
||||
private System.Windows.Forms.NumericUpDown backoffsety;
|
||||
private System.Windows.Forms.NumericUpDown backoffsetx;
|
||||
private System.Windows.Forms.CheckBox showbackground;
|
||||
private System.Windows.Forms.Button cancel;
|
||||
private System.Windows.Forms.Button apply;
|
||||
private System.Windows.Forms.Label backoffset;
|
||||
}
|
||||
}
|
146
Source/Interface/GridSetupForm.cs
Normal file
146
Source/Interface/GridSetupForm.cs
Normal file
|
@ -0,0 +1,146 @@
|
|||
|
||||
#region ================== Copyright (c) 2007 Pascal vd Heiden
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
|
||||
* This program is released under GNU General Public License
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Namespaces
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.Data;
|
||||
using CodeImp.DoomBuilder.IO;
|
||||
using System.IO;
|
||||
using CodeImp.DoomBuilder.Config;
|
||||
using CodeImp.DoomBuilder.Editing;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public partial class GridSetupForm : DelayedForm
|
||||
{
|
||||
// Variables
|
||||
private string backgroundname;
|
||||
private int backgroundsource;
|
||||
|
||||
// Constructor
|
||||
public GridSetupForm()
|
||||
{
|
||||
// Initialize
|
||||
InitializeComponent();
|
||||
|
||||
// Show grid size
|
||||
gridsize.Value = General.Map.Grid.GridSize;
|
||||
|
||||
// Background image?
|
||||
if((General.Map.Grid.Background != null) &&
|
||||
!(General.Map.Grid.Background is NullImage))
|
||||
{
|
||||
// Show background image
|
||||
showbackground.Checked = true;
|
||||
backgroundname = General.Map.Grid.BackgroundName;
|
||||
backgroundsource = General.Map.Grid.BackgroundSource;
|
||||
General.DisplayZoomedImage(backgroundimage, General.Map.Grid.Background.Bitmap);
|
||||
}
|
||||
else
|
||||
{
|
||||
// No background image
|
||||
showbackground.Checked = false;
|
||||
}
|
||||
|
||||
// Show background offset
|
||||
backoffsetx.Value = General.Map.Grid.BackgroundX;
|
||||
backoffsety.Value = General.Map.Grid.BackgroundY;
|
||||
}
|
||||
|
||||
// Show Background changed
|
||||
private void showbackground_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
// Enable/disable controls
|
||||
selecttexture.Enabled = showbackground.Checked;
|
||||
selectflat.Enabled = showbackground.Checked;
|
||||
backoffset.Enabled = showbackground.Checked;
|
||||
backoffsetx.Enabled = showbackground.Checked;
|
||||
backoffsety.Enabled = showbackground.Checked;
|
||||
}
|
||||
|
||||
// Browse texture
|
||||
private void selecttexture_Click(object sender, EventArgs e)
|
||||
{
|
||||
string result;
|
||||
|
||||
// Browse for texture
|
||||
result = TextureBrowserForm.Browse(this, backgroundname);
|
||||
if(result != null)
|
||||
{
|
||||
// Set this texture as background
|
||||
backgroundname = result;
|
||||
backgroundsource = GridSetup.SOURCE_TEXTURES;
|
||||
General.DisplayZoomedImage(backgroundimage, General.Map.Data.GetTextureBitmap(result));
|
||||
}
|
||||
}
|
||||
|
||||
// Browse flat
|
||||
private void selectflat_Click(object sender, EventArgs e)
|
||||
{
|
||||
string result;
|
||||
|
||||
// Browse for flat
|
||||
result = FlatBrowserForm.Browse(this, backgroundname);
|
||||
if(result != null)
|
||||
{
|
||||
// Set this flat as background
|
||||
backgroundname = result;
|
||||
backgroundsource = GridSetup.SOURCE_FLATS;
|
||||
General.DisplayZoomedImage(backgroundimage, General.Map.Data.GetFlatBitmap(result));
|
||||
}
|
||||
}
|
||||
|
||||
// Cancelled
|
||||
private void cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
// Apply
|
||||
private void apply_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Apply
|
||||
General.Map.Grid.SetGridSize((int)gridsize.Value);
|
||||
General.Map.Grid.SetBackgroundOffset((int)backoffsetx.Value, (int)backoffsety.Value);
|
||||
|
||||
// Background image?
|
||||
if(showbackground.Checked)
|
||||
{
|
||||
// Set background image
|
||||
General.Map.Grid.SetBackground(backgroundname, backgroundsource);
|
||||
}
|
||||
else
|
||||
{
|
||||
// No background image
|
||||
General.Map.Grid.SetBackground(null, 0);
|
||||
}
|
||||
|
||||
// Done
|
||||
DialogResult = DialogResult.OK;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
171
Source/Interface/GridSetupForm.resx
Normal file
171
Source/Interface/GridSetupForm.resx
Normal file
|
@ -0,0 +1,171 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="groupBox1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="groupBox1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="gridsize.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="label1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="label1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="groupBox2.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="groupBox2.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="showbackground.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="backoffsety.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="backoffsetx.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="backoffset.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="selectflat.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="selecttexture.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="backgroundimage.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="cancel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="apply.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
|
@ -94,29 +94,32 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
// Draw item
|
||||
private void list_DrawItem(object sender, DrawListViewItemEventArgs e)
|
||||
{
|
||||
if(!updating)
|
||||
e.Graphics.DrawImageUnscaled((e.Item as ImageBrowserItem).GetImage(e.Bounds), e.Bounds);
|
||||
if(!updating) e.Graphics.DrawImageUnscaled((e.Item as ImageBrowserItem).GetImage(e.Bounds), e.Bounds);
|
||||
}
|
||||
|
||||
// Resfresher
|
||||
private void refreshtimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
// Continue refreshing only when still loading data
|
||||
refreshtimer.Enabled = General.Map.Data.IsLoading;
|
||||
|
||||
// Go for all items
|
||||
foreach(ImageBrowserItem i in list.Items)
|
||||
{
|
||||
// Items needs to be redrawn?
|
||||
if(i.CheckRedrawNeeded(i.Bounds))
|
||||
// Bounds within view?
|
||||
if(i.Bounds.IntersectsWith(list.ClientRectangle))
|
||||
{
|
||||
// Redraw item
|
||||
i.GetImage(i.Bounds);
|
||||
// Items needs to be redrawn?
|
||||
if(i.CheckRedrawNeeded(i.Bounds))
|
||||
{
|
||||
// Redraw item
|
||||
i.GetImage(i.Bounds);
|
||||
|
||||
// Refresh item in list
|
||||
list.RedrawItems(i.Index, i.Index, false);
|
||||
// Refresh item in list
|
||||
list.RedrawItems(i.Index, i.Index, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Continue refreshing only when still loading data
|
||||
refreshtimer.Enabled = General.Map.Data.IsLoading;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -264,7 +267,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
RefillList();
|
||||
|
||||
// Start updating if needed
|
||||
refreshtimer.Enabled = true;
|
||||
refreshtimer.Enabled = General.Map.Data.IsLoading;
|
||||
|
||||
// Select first item
|
||||
SelectFirstItem();
|
||||
|
|
267
Source/Interface/MainForm.Designer.cs
generated
267
Source/Interface/MainForm.Designer.cs
generated
|
@ -33,9 +33,16 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
System.Windows.Forms.ToolStripSeparator toolStripMenuItem2;
|
||||
System.Windows.Forms.ToolStripSeparator toolStripMenuItem3;
|
||||
System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
|
||||
System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
|
||||
System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
|
||||
System.Windows.Forms.ToolStripSeparator toolStripSeparator9;
|
||||
System.Windows.Forms.ToolStripSeparator toolStripSeparator6;
|
||||
System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
|
||||
System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
|
||||
System.Windows.Forms.ToolStripSeparator toolStripSeparator7;
|
||||
System.Windows.Forms.ToolStripSeparator toolStripMenuItem4;
|
||||
System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
|
||||
this.poscommalabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.menumain = new System.Windows.Forms.MenuStrip();
|
||||
this.menufile = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.itemnewmap = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -51,7 +58,6 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.itemlinedefsmode = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.itemsectorsmode = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.itemthingsmode = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.itemmapoptions = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menutools = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.itemreloadresources = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -63,19 +69,28 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.buttonnewmap = new System.Windows.Forms.ToolStripButton();
|
||||
this.buttonopenmap = new System.Windows.Forms.ToolStripButton();
|
||||
this.buttonsavemap = new System.Windows.Forms.ToolStripButton();
|
||||
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.buttonmapoptions = new System.Windows.Forms.ToolStripButton();
|
||||
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.buttonverticesmode = new System.Windows.Forms.ToolStripButton();
|
||||
this.buttonlinedefsmode = new System.Windows.Forms.ToolStripButton();
|
||||
this.buttonsectorsmode = new System.Windows.Forms.ToolStripButton();
|
||||
this.buttonthingsmode = new System.Windows.Forms.ToolStripButton();
|
||||
this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.buttonthingsfilter = new System.Windows.Forms.ToolStripButton();
|
||||
this.thingfilters = new System.Windows.Forms.ToolStripComboBox();
|
||||
this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.statusbar = new System.Windows.Forms.StatusStrip();
|
||||
this.statuslabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.gridlabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.buttongrid = new System.Windows.Forms.ToolStripDropDownButton();
|
||||
this.itemgrid1024 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.itemgrid512 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.itemgrid256 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.itemgrid128 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.itemgrid64 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.itemgrid32 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.itemgrid16 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.itemgrid8 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.itemgrid4 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.itemgridcustom = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.zoomlabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.buttonzoom = new System.Windows.Forms.ToolStripDropDownButton();
|
||||
this.itemzoom200 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -84,7 +99,6 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.itemzoom25 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.itemzoom10 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.itemzoom5 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.itemzoomfittoscreen = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.xposlabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.yposlabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
|
@ -99,8 +113,14 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolStripMenuItem4 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.menumain.SuspendLayout();
|
||||
this.toolbar.SuspendLayout();
|
||||
this.statusbar.SuspendLayout();
|
||||
|
@ -124,21 +144,61 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
//
|
||||
// toolStripSeparator1
|
||||
//
|
||||
toolStripSeparator1.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||
toolStripSeparator1.Name = "toolStripSeparator1";
|
||||
toolStripSeparator1.Size = new System.Drawing.Size(6, 23);
|
||||
//
|
||||
// toolStripStatusLabel1
|
||||
// poscommalabel
|
||||
//
|
||||
toolStripStatusLabel1.Name = "toolStripStatusLabel1";
|
||||
toolStripStatusLabel1.Size = new System.Drawing.Size(11, 18);
|
||||
toolStripStatusLabel1.Text = ",";
|
||||
toolStripStatusLabel1.ToolTipText = "Current X, Y coordinates on map";
|
||||
this.poscommalabel.Name = "poscommalabel";
|
||||
this.poscommalabel.Size = new System.Drawing.Size(11, 18);
|
||||
this.poscommalabel.Text = ",";
|
||||
this.poscommalabel.ToolTipText = "Current X, Y coordinates on map";
|
||||
//
|
||||
// toolStripSeparator4
|
||||
//
|
||||
toolStripSeparator4.Name = "toolStripSeparator4";
|
||||
toolStripSeparator4.Size = new System.Drawing.Size(194, 6);
|
||||
//
|
||||
// toolStripSeparator9
|
||||
//
|
||||
toolStripSeparator9.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||
toolStripSeparator9.Name = "toolStripSeparator9";
|
||||
toolStripSeparator9.Size = new System.Drawing.Size(6, 23);
|
||||
//
|
||||
// toolStripSeparator6
|
||||
//
|
||||
toolStripSeparator6.Name = "toolStripSeparator6";
|
||||
toolStripSeparator6.Size = new System.Drawing.Size(158, 6);
|
||||
//
|
||||
// toolStripSeparator3
|
||||
//
|
||||
toolStripSeparator3.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||
toolStripSeparator3.Name = "toolStripSeparator3";
|
||||
toolStripSeparator3.Size = new System.Drawing.Size(6, 25);
|
||||
//
|
||||
// toolStripSeparator5
|
||||
//
|
||||
toolStripSeparator5.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||
toolStripSeparator5.Name = "toolStripSeparator5";
|
||||
toolStripSeparator5.Size = new System.Drawing.Size(6, 25);
|
||||
//
|
||||
// toolStripSeparator7
|
||||
//
|
||||
toolStripSeparator7.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||
toolStripSeparator7.Name = "toolStripSeparator7";
|
||||
toolStripSeparator7.Size = new System.Drawing.Size(6, 25);
|
||||
//
|
||||
// toolStripMenuItem4
|
||||
//
|
||||
toolStripMenuItem4.Name = "toolStripMenuItem4";
|
||||
toolStripMenuItem4.Size = new System.Drawing.Size(161, 6);
|
||||
//
|
||||
// toolStripSeparator2
|
||||
//
|
||||
toolStripSeparator2.Name = "toolStripSeparator2";
|
||||
toolStripSeparator2.Size = new System.Drawing.Size(164, 6);
|
||||
//
|
||||
// menumain
|
||||
//
|
||||
this.menumain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
|
@ -241,7 +301,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.itemlinedefsmode,
|
||||
this.itemsectorsmode,
|
||||
this.itemthingsmode,
|
||||
this.toolStripSeparator6,
|
||||
toolStripSeparator6,
|
||||
this.itemmapoptions});
|
||||
this.menuedit.Name = "menuedit";
|
||||
this.menuedit.Size = new System.Drawing.Size(37, 20);
|
||||
|
@ -283,11 +343,6 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.itemthingsmode.Text = "Things Mode";
|
||||
this.itemthingsmode.Click += new System.EventHandler(this.InvokeTaggedAction);
|
||||
//
|
||||
// toolStripSeparator6
|
||||
//
|
||||
this.toolStripSeparator6.Name = "toolStripSeparator6";
|
||||
this.toolStripSeparator6.Size = new System.Drawing.Size(158, 6);
|
||||
//
|
||||
// itemmapoptions
|
||||
//
|
||||
this.itemmapoptions.Image = global::CodeImp.DoomBuilder.Properties.Resources.Properties;
|
||||
|
@ -354,14 +409,14 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.buttonnewmap,
|
||||
this.buttonopenmap,
|
||||
this.buttonsavemap,
|
||||
this.toolStripSeparator3,
|
||||
toolStripSeparator3,
|
||||
this.buttonmapoptions,
|
||||
this.toolStripSeparator5,
|
||||
toolStripSeparator5,
|
||||
this.buttonverticesmode,
|
||||
this.buttonlinedefsmode,
|
||||
this.buttonsectorsmode,
|
||||
this.buttonthingsmode,
|
||||
this.toolStripSeparator7,
|
||||
toolStripSeparator7,
|
||||
this.buttonthingsfilter,
|
||||
this.thingfilters,
|
||||
this.toolStripSeparator8});
|
||||
|
@ -403,12 +458,6 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.buttonsavemap.Text = "Save Map";
|
||||
this.buttonsavemap.Click += new System.EventHandler(this.InvokeTaggedAction);
|
||||
//
|
||||
// toolStripSeparator3
|
||||
//
|
||||
this.toolStripSeparator3.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||
this.toolStripSeparator3.Name = "toolStripSeparator3";
|
||||
this.toolStripSeparator3.Size = new System.Drawing.Size(6, 25);
|
||||
//
|
||||
// buttonmapoptions
|
||||
//
|
||||
this.buttonmapoptions.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
|
@ -420,12 +469,6 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.buttonmapoptions.Text = "Map Options";
|
||||
this.buttonmapoptions.Click += new System.EventHandler(this.InvokeTaggedAction);
|
||||
//
|
||||
// toolStripSeparator5
|
||||
//
|
||||
this.toolStripSeparator5.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||
this.toolStripSeparator5.Name = "toolStripSeparator5";
|
||||
this.toolStripSeparator5.Size = new System.Drawing.Size(6, 25);
|
||||
//
|
||||
// buttonverticesmode
|
||||
//
|
||||
this.buttonverticesmode.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
|
@ -470,12 +513,6 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.buttonthingsmode.Text = "Things Mode";
|
||||
this.buttonthingsmode.Click += new System.EventHandler(this.InvokeTaggedAction);
|
||||
//
|
||||
// toolStripSeparator7
|
||||
//
|
||||
this.toolStripSeparator7.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||
this.toolStripSeparator7.Name = "toolStripSeparator7";
|
||||
this.toolStripSeparator7.Size = new System.Drawing.Size(6, 25);
|
||||
//
|
||||
// buttonthingsfilter
|
||||
//
|
||||
this.buttonthingsfilter.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
|
@ -511,11 +548,14 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.statusbar.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.statusbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.statuslabel,
|
||||
this.gridlabel,
|
||||
this.buttongrid,
|
||||
toolStripSeparator1,
|
||||
this.zoomlabel,
|
||||
this.buttonzoom,
|
||||
toolStripSeparator1,
|
||||
toolStripSeparator9,
|
||||
this.xposlabel,
|
||||
toolStripStatusLabel1,
|
||||
this.poscommalabel,
|
||||
this.yposlabel});
|
||||
this.statusbar.Location = new System.Drawing.Point(0, 522);
|
||||
this.statusbar.Name = "statusbar";
|
||||
|
@ -529,22 +569,137 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.statuslabel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.statuslabel.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
|
||||
this.statuslabel.Name = "statuslabel";
|
||||
this.statuslabel.Size = new System.Drawing.Size(628, 18);
|
||||
this.statuslabel.Size = new System.Drawing.Size(482, 18);
|
||||
this.statuslabel.Spring = true;
|
||||
this.statuslabel.Text = "Initializing user interface...";
|
||||
this.statuslabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// gridlabel
|
||||
//
|
||||
this.gridlabel.AutoSize = false;
|
||||
this.gridlabel.AutoToolTip = true;
|
||||
this.gridlabel.Name = "gridlabel";
|
||||
this.gridlabel.Size = new System.Drawing.Size(64, 18);
|
||||
this.gridlabel.Text = "32 mp";
|
||||
this.gridlabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.gridlabel.TextImageRelation = System.Windows.Forms.TextImageRelation.Overlay;
|
||||
this.gridlabel.ToolTipText = "Grid size";
|
||||
//
|
||||
// buttongrid
|
||||
//
|
||||
this.buttongrid.AutoToolTip = false;
|
||||
this.buttongrid.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.buttongrid.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.itemgrid1024,
|
||||
this.itemgrid512,
|
||||
this.itemgrid256,
|
||||
this.itemgrid128,
|
||||
this.itemgrid64,
|
||||
this.itemgrid32,
|
||||
this.itemgrid16,
|
||||
this.itemgrid8,
|
||||
this.itemgrid4,
|
||||
toolStripMenuItem4,
|
||||
this.itemgridcustom});
|
||||
this.buttongrid.Image = global::CodeImp.DoomBuilder.Properties.Resources.Grid2;
|
||||
this.buttongrid.ImageTransparentColor = System.Drawing.Color.Transparent;
|
||||
this.buttongrid.Name = "buttongrid";
|
||||
this.buttongrid.Size = new System.Drawing.Size(29, 21);
|
||||
this.buttongrid.Text = "Grid";
|
||||
//
|
||||
// itemgrid1024
|
||||
//
|
||||
this.itemgrid1024.Name = "itemgrid1024";
|
||||
this.itemgrid1024.Size = new System.Drawing.Size(164, 22);
|
||||
this.itemgrid1024.Tag = "1024";
|
||||
this.itemgrid1024.Text = "1024 mp";
|
||||
this.itemgrid1024.Click += new System.EventHandler(this.itemgridsize_Click);
|
||||
//
|
||||
// itemgrid512
|
||||
//
|
||||
this.itemgrid512.Name = "itemgrid512";
|
||||
this.itemgrid512.Size = new System.Drawing.Size(164, 22);
|
||||
this.itemgrid512.Tag = "512";
|
||||
this.itemgrid512.Text = "512 mp";
|
||||
this.itemgrid512.Click += new System.EventHandler(this.itemgridsize_Click);
|
||||
//
|
||||
// itemgrid256
|
||||
//
|
||||
this.itemgrid256.Name = "itemgrid256";
|
||||
this.itemgrid256.Size = new System.Drawing.Size(164, 22);
|
||||
this.itemgrid256.Tag = "256";
|
||||
this.itemgrid256.Text = "256 mp";
|
||||
this.itemgrid256.Click += new System.EventHandler(this.itemgridsize_Click);
|
||||
//
|
||||
// itemgrid128
|
||||
//
|
||||
this.itemgrid128.Name = "itemgrid128";
|
||||
this.itemgrid128.Size = new System.Drawing.Size(164, 22);
|
||||
this.itemgrid128.Tag = "128";
|
||||
this.itemgrid128.Text = "128 mp";
|
||||
this.itemgrid128.Click += new System.EventHandler(this.itemgridsize_Click);
|
||||
//
|
||||
// itemgrid64
|
||||
//
|
||||
this.itemgrid64.Name = "itemgrid64";
|
||||
this.itemgrid64.Size = new System.Drawing.Size(164, 22);
|
||||
this.itemgrid64.Tag = "64";
|
||||
this.itemgrid64.Text = "64 mp";
|
||||
this.itemgrid64.Click += new System.EventHandler(this.itemgridsize_Click);
|
||||
//
|
||||
// itemgrid32
|
||||
//
|
||||
this.itemgrid32.Name = "itemgrid32";
|
||||
this.itemgrid32.Size = new System.Drawing.Size(164, 22);
|
||||
this.itemgrid32.Tag = "32";
|
||||
this.itemgrid32.Text = "32 mp";
|
||||
this.itemgrid32.Click += new System.EventHandler(this.itemgridsize_Click);
|
||||
//
|
||||
// itemgrid16
|
||||
//
|
||||
this.itemgrid16.Name = "itemgrid16";
|
||||
this.itemgrid16.Size = new System.Drawing.Size(164, 22);
|
||||
this.itemgrid16.Tag = "16";
|
||||
this.itemgrid16.Text = "16 mp";
|
||||
this.itemgrid16.Click += new System.EventHandler(this.itemgridsize_Click);
|
||||
//
|
||||
// itemgrid8
|
||||
//
|
||||
this.itemgrid8.Name = "itemgrid8";
|
||||
this.itemgrid8.Size = new System.Drawing.Size(164, 22);
|
||||
this.itemgrid8.Tag = "8";
|
||||
this.itemgrid8.Text = "8 mp";
|
||||
this.itemgrid8.Click += new System.EventHandler(this.itemgridsize_Click);
|
||||
//
|
||||
// itemgrid4
|
||||
//
|
||||
this.itemgrid4.Name = "itemgrid4";
|
||||
this.itemgrid4.Size = new System.Drawing.Size(164, 22);
|
||||
this.itemgrid4.Tag = "4";
|
||||
this.itemgrid4.Text = "4 mp";
|
||||
this.itemgrid4.Click += new System.EventHandler(this.itemgridsize_Click);
|
||||
//
|
||||
// itemgridcustom
|
||||
//
|
||||
this.itemgridcustom.Name = "itemgridcustom";
|
||||
this.itemgridcustom.Size = new System.Drawing.Size(164, 22);
|
||||
this.itemgridcustom.Text = "Customize...";
|
||||
this.itemgridcustom.Click += new System.EventHandler(this.itemgridcustom_Click);
|
||||
//
|
||||
// zoomlabel
|
||||
//
|
||||
this.zoomlabel.AutoSize = false;
|
||||
this.zoomlabel.AutoToolTip = true;
|
||||
this.zoomlabel.Name = "zoomlabel";
|
||||
this.zoomlabel.Size = new System.Drawing.Size(50, 18);
|
||||
this.zoomlabel.Size = new System.Drawing.Size(54, 18);
|
||||
this.zoomlabel.Text = "50%";
|
||||
this.zoomlabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.zoomlabel.TextImageRelation = System.Windows.Forms.TextImageRelation.Overlay;
|
||||
this.zoomlabel.ToolTipText = "Zoom level";
|
||||
//
|
||||
// buttonzoom
|
||||
//
|
||||
this.buttonzoom.AutoToolTip = false;
|
||||
this.buttonzoom.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.buttonzoom.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.itemzoom200,
|
||||
|
@ -553,14 +708,13 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.itemzoom25,
|
||||
this.itemzoom10,
|
||||
this.itemzoom5,
|
||||
this.toolStripSeparator2,
|
||||
toolStripSeparator2,
|
||||
this.itemzoomfittoscreen});
|
||||
this.buttonzoom.Image = global::CodeImp.DoomBuilder.Properties.Resources.Zoom;
|
||||
this.buttonzoom.ImageTransparentColor = System.Drawing.Color.Transparent;
|
||||
this.buttonzoom.Name = "buttonzoom";
|
||||
this.buttonzoom.Size = new System.Drawing.Size(29, 21);
|
||||
this.buttonzoom.Text = "Zoom";
|
||||
this.buttonzoom.ToolTipText = "Zoom level";
|
||||
//
|
||||
// itemzoom200
|
||||
//
|
||||
|
@ -610,11 +764,6 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.itemzoom5.Text = "5%";
|
||||
this.itemzoom5.Click += new System.EventHandler(this.itemzoomto_Click);
|
||||
//
|
||||
// toolStripSeparator2
|
||||
//
|
||||
this.toolStripSeparator2.Name = "toolStripSeparator2";
|
||||
this.toolStripSeparator2.Size = new System.Drawing.Size(164, 6);
|
||||
//
|
||||
// itemzoomfittoscreen
|
||||
//
|
||||
this.itemzoomfittoscreen.Name = "itemzoomfittoscreen";
|
||||
|
@ -783,7 +932,6 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
private System.Windows.Forms.ToolStripStatusLabel zoomlabel;
|
||||
private System.Windows.Forms.ToolStripDropDownButton buttonzoom;
|
||||
private System.Windows.Forms.ToolStripMenuItem itemzoomfittoscreen;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
|
||||
private System.Windows.Forms.ToolStripMenuItem itemzoom100;
|
||||
private System.Windows.Forms.ToolStripMenuItem itemzoom200;
|
||||
private System.Windows.Forms.ToolStripMenuItem itemzoom50;
|
||||
|
@ -793,28 +941,37 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
private System.Windows.Forms.ToolStripMenuItem menutools;
|
||||
private System.Windows.Forms.ToolStripMenuItem configurationToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem preferencesToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
|
||||
private System.Windows.Forms.ToolStripMenuItem menuedit;
|
||||
private System.Windows.Forms.ToolStripMenuItem itemmapoptions;
|
||||
private System.Windows.Forms.ToolStripButton buttonmapoptions;
|
||||
private System.Windows.Forms.ToolStripMenuItem itemreloadresources;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
|
||||
private System.Windows.Forms.ToolStripButton buttonverticesmode;
|
||||
private System.Windows.Forms.ToolStripButton buttonlinedefsmode;
|
||||
private System.Windows.Forms.ToolStripButton buttonsectorsmode;
|
||||
private System.Windows.Forms.ToolStripMenuItem itemverticesmode;
|
||||
private System.Windows.Forms.ToolStripMenuItem itemlinedefsmode;
|
||||
private System.Windows.Forms.ToolStripMenuItem itemsectorsmode;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator6;
|
||||
private System.Windows.Forms.ToolStripButton buttonthingsmode;
|
||||
private System.Windows.Forms.ToolStripMenuItem itemthingsmode;
|
||||
private LinedefInfoPanel linedefinfo;
|
||||
private VertexInfoPanel vertexinfo;
|
||||
private SectorInfoPanel sectorinfo;
|
||||
private ThingInfoPanel thinginfo;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator7;
|
||||
private System.Windows.Forms.ToolStripButton buttonthingsfilter;
|
||||
private System.Windows.Forms.ToolStripComboBox thingfilters;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator8;
|
||||
private System.Windows.Forms.ToolStripStatusLabel gridlabel;
|
||||
private System.Windows.Forms.ToolStripDropDownButton buttongrid;
|
||||
private System.Windows.Forms.ToolStripMenuItem itemgrid1024;
|
||||
private System.Windows.Forms.ToolStripMenuItem itemgrid256;
|
||||
private System.Windows.Forms.ToolStripMenuItem itemgrid128;
|
||||
private System.Windows.Forms.ToolStripMenuItem itemgrid64;
|
||||
private System.Windows.Forms.ToolStripMenuItem itemgrid32;
|
||||
private System.Windows.Forms.ToolStripMenuItem itemgrid16;
|
||||
private System.Windows.Forms.ToolStripMenuItem itemgrid4;
|
||||
private System.Windows.Forms.ToolStripMenuItem itemgrid8;
|
||||
private System.Windows.Forms.ToolStripMenuItem itemgridcustom;
|
||||
private System.Windows.Forms.ToolStripMenuItem itemgrid512;
|
||||
private System.Windows.Forms.ToolStripStatusLabel poscommalabel;
|
||||
}
|
||||
}
|
|
@ -84,8 +84,11 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
// Setup controls
|
||||
InitializeComponent();
|
||||
|
||||
// Fix things
|
||||
// Visual Studio IDE doesn't let me set these in the designer :(
|
||||
buttonzoom.Font = menufile.Font;
|
||||
buttonzoom.DropDownDirection = ToolStripDropDownDirection.AboveLeft;
|
||||
buttongrid.Font = menufile.Font;
|
||||
buttongrid.DropDownDirection = ToolStripDropDownDirection.AboveLeft;
|
||||
|
||||
// Bind any methods
|
||||
ActionAttribute.BindMethods(this);
|
||||
|
@ -123,6 +126,9 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.Text = Application.ProductName;
|
||||
}
|
||||
|
||||
// Update the status bar
|
||||
UpdateStatusbar();
|
||||
|
||||
// Update menus and toolbar icons
|
||||
UpdateFileMenu();
|
||||
UpdateEditMenu();
|
||||
|
@ -228,6 +234,36 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
|
||||
#region ================== Statusbar
|
||||
|
||||
// This updates the status bar
|
||||
private void UpdateStatusbar()
|
||||
{
|
||||
// Map open?
|
||||
if(General.Map != null)
|
||||
{
|
||||
// Enable items
|
||||
xposlabel.Enabled = true;
|
||||
yposlabel.Enabled = true;
|
||||
poscommalabel.Enabled = true;
|
||||
zoomlabel.Enabled = true;
|
||||
buttonzoom.Enabled = true;
|
||||
gridlabel.Enabled = true;
|
||||
buttongrid.Enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Disable items
|
||||
xposlabel.Text = "--";
|
||||
yposlabel.Text = "--";
|
||||
xposlabel.Enabled = false;
|
||||
yposlabel.Enabled = false;
|
||||
poscommalabel.Enabled = false;
|
||||
zoomlabel.Enabled = false;
|
||||
buttonzoom.Enabled = false;
|
||||
gridlabel.Enabled = false;
|
||||
buttongrid.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
// This returns the current status text
|
||||
public string GetCurrentSatus()
|
||||
{
|
||||
|
@ -366,6 +402,69 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
if(General.Map.Mode is ClassicMode)
|
||||
(General.Map.Mode as ClassicMode).CenterInScreen();
|
||||
}
|
||||
|
||||
// This changes grid display
|
||||
public void UpdateGrid(int gridsize)
|
||||
{
|
||||
// Update grid label
|
||||
if(gridsize == 0)
|
||||
gridlabel.Text = "--";
|
||||
else
|
||||
gridlabel.Text = gridsize.ToString("###0") + " mp";
|
||||
|
||||
// Update status bar
|
||||
//statusbar.Update();
|
||||
}
|
||||
|
||||
// Set grid to a specified size
|
||||
private void itemgridsize_Click(object sender, EventArgs e)
|
||||
{
|
||||
int size;
|
||||
|
||||
if(General.Map == null) return;
|
||||
|
||||
// In classic mode?
|
||||
if(General.Map.Mode is ClassicMode)
|
||||
{
|
||||
// Requested from menu?
|
||||
if(sender is ToolStripMenuItem)
|
||||
{
|
||||
// Get integral zoom level
|
||||
size = int.Parse((sender as ToolStripMenuItem).Tag.ToString(), CultureInfo.InvariantCulture);
|
||||
|
||||
// Change grid size
|
||||
General.Map.Grid.SetGridSize(size);
|
||||
|
||||
// Redraw display
|
||||
RedrawDisplay();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Show grid setup
|
||||
private void itemgridcustom_Click(object sender, EventArgs e)
|
||||
{
|
||||
ShowGridSetup();
|
||||
}
|
||||
|
||||
// This shows the grid setup dialog
|
||||
[Action("gridsetup")]
|
||||
public void ShowGridSetup()
|
||||
{
|
||||
// Only when a map is open
|
||||
if(General.Map == null) return;
|
||||
|
||||
// Show preferences dialog
|
||||
GridSetupForm gridform = new GridSetupForm();
|
||||
if(gridform.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
// Redraw display
|
||||
RedrawDisplay();
|
||||
}
|
||||
|
||||
// Done
|
||||
gridform.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -803,7 +902,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
}
|
||||
|
||||
// Game Configuration action
|
||||
[Action(Action.CONFIGURATION)]
|
||||
[Action("configuration")]
|
||||
public void ShowConfiguration()
|
||||
{
|
||||
// Show configuration dialog
|
||||
|
@ -825,7 +924,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
}
|
||||
|
||||
// Preferences action
|
||||
[Action(Action.PREFERENCES)]
|
||||
[Action("preferences")]
|
||||
public void ShowPreferences()
|
||||
{
|
||||
// Show preferences dialog
|
||||
|
|
|
@ -129,10 +129,28 @@
|
|||
<metadata name="toolStripSeparator1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="toolStripStatusLabel1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="toolStripSeparator4.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="toolStripSeparator4.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="toolStripSeparator9.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="toolStripSeparator6.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="toolStripSeparator3.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="toolStripSeparator5.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="toolStripSeparator7.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="toolStripMenuItem4.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="toolStripSeparator2.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="menumain.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
|
|
|
@ -79,12 +79,10 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
foreach(Sector s in General.Map.Map.Sectors)
|
||||
{
|
||||
// Add floor flat
|
||||
if(s.FloorTexture.Length > 0)
|
||||
if(!useditems.ContainsKey(s.LongFloorTexture)) useditems.Add(s.LongFloorTexture, 0);
|
||||
if(!useditems.ContainsKey(s.LongFloorTexture)) useditems.Add(s.LongFloorTexture, 0);
|
||||
|
||||
// Add ceil flat
|
||||
if(s.CeilTexture.Length > 0)
|
||||
if(!useditems.ContainsKey(s.LongCeilTexture)) useditems.Add(s.LongCeilTexture, 0);
|
||||
if(!useditems.ContainsKey(s.LongCeilTexture)) useditems.Add(s.LongCeilTexture, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,6 +117,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
{
|
||||
// Set selected name and close
|
||||
selectedname = browser.SelectedItem.Text;
|
||||
DialogResult = DialogResult.OK;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
|
@ -127,6 +126,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
{
|
||||
// No selection, close
|
||||
selectedname = "";
|
||||
DialogResult = DialogResult.Cancel;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
|
@ -200,5 +200,22 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
General.Settings.WriteSetting("browserwindow.sizeheight", lastsize.Height);
|
||||
General.Settings.WriteSetting("browserwindow.windowstate", windowstate);
|
||||
}
|
||||
|
||||
// Static method to browse for texture
|
||||
// Returns null when cancelled.
|
||||
public static string Browse(IWin32Window parent, string select)
|
||||
{
|
||||
TextureBrowserForm browser = new TextureBrowserForm();
|
||||
if(browser.ShowDialog(parent) == DialogResult.OK)
|
||||
{
|
||||
// Return result
|
||||
return browser.SelectedName;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Cancelled
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -164,6 +164,13 @@ namespace CodeImp.DoomBuilder.Map
|
|||
|
||||
#region ================== Changes
|
||||
|
||||
// This moves the vertex
|
||||
public void Move(Vector2D newpos)
|
||||
{
|
||||
// Change position
|
||||
this.Move((int)Math.Round(newpos.x), (int)Math.Round(newpos.y));
|
||||
}
|
||||
|
||||
// This moves the vertex
|
||||
public void Move(int newx, int newy)
|
||||
{
|
||||
|
|
7
Source/Properties/Resources.Designer.cs
generated
7
Source/Properties/Resources.Designer.cs
generated
|
@ -81,6 +81,13 @@ namespace CodeImp.DoomBuilder.Properties {
|
|||
}
|
||||
}
|
||||
|
||||
internal static System.Drawing.Bitmap Grid2 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Grid2", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
internal static System.Drawing.Bitmap Hourglass {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Hourglass", resourceCulture);
|
||||
|
|
|
@ -118,61 +118,64 @@
|
|||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="ColorPick" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ColorPick.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="NewMap" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\NewMap2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
<data name="Zoom" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Zoom.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Properties" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Properties.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Splash2small" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Splash2small.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="VerticesMode" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\VerticesMode.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="ThingsMode" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ThingsMode.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
<data name="LinesMode" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\LinesMode.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Splash2" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Splash2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="SectorsMode" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\SectorsMode.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
<data name="Filter" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Filter.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="File" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\NewMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="OpenMap" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\OpenMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="UnknownImage" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\UnknownImage.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Zoom" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Zoom.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="SaveMap" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\SaveMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="LinesMode" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\LinesMode.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
<data name="Splash2small" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Splash2small.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Status0" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Status0.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Status1" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Status1.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
<data name="NewMap" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\NewMap2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="ColorPick" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ColorPick.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="SectorsMode" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\SectorsMode.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="UnknownImage" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\UnknownImage.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="OpenMap" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\OpenMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="ThingsMode" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ThingsMode.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="SaveMap" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\SaveMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Status2" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Status2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Filter" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Filter.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
<data name="VerticesMode" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\VerticesMode.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Status1" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Status1.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Hourglass" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Hourglass.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="File" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\NewMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Grid2" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Grid2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
|
@ -119,6 +119,8 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
private void SetupSettings()
|
||||
{
|
||||
// Setup renderstates
|
||||
device.SetRenderState(RenderState.AlphaRef, 0x0000007F);
|
||||
device.SetRenderState(RenderState.AlphaFunc, Compare.GreaterEqual);
|
||||
device.SetRenderState(RenderState.AntialiasedLineEnable, false);
|
||||
device.SetRenderState(RenderState.Ambient, Color.White.ToArgb());
|
||||
device.SetRenderState(RenderState.AmbientMaterialSource, ColorSource.Material);
|
||||
|
@ -303,8 +305,8 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
foreach(ID3DResource res in resources) res.UnloadResource();
|
||||
|
||||
// Lose backbuffers
|
||||
backbuffer.Dispose();
|
||||
depthbuffer.Dispose();
|
||||
if(backbuffer != null) backbuffer.Dispose();
|
||||
if(depthbuffer != null) depthbuffer.Dispose();
|
||||
backbuffer = null;
|
||||
depthbuffer = null;
|
||||
|
||||
|
|
|
@ -151,6 +151,24 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
}
|
||||
}
|
||||
|
||||
// This draws a dotted grid line horizontally
|
||||
public void DrawGridLineH(int y, PixelColor c)
|
||||
{
|
||||
int numpixels = visiblewidth >> 1;
|
||||
|
||||
// Draw all pixels on this line
|
||||
for(int i = 0; i < numpixels; i++) DrawPixelSolid(i << 1, y, c);
|
||||
}
|
||||
|
||||
// This draws a dotted grid line vertically
|
||||
public void DrawGridLineV(int x, PixelColor c)
|
||||
{
|
||||
int numpixels = visibleheight >> 1;
|
||||
|
||||
// Draw all pixels on this line
|
||||
for(int i = 0; i < numpixels; i++) DrawPixelSolid(x, i << 1, c);
|
||||
}
|
||||
|
||||
// This draws a pixel alpha blended
|
||||
public void DrawPixelAlpha(int x, int y, PixelColor c)
|
||||
{
|
||||
|
@ -180,79 +198,6 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
}
|
||||
}
|
||||
|
||||
// This draws a line alpha blended
|
||||
// See: http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm
|
||||
public void DrawLineAlpha(int x1, int y1, int x2, int y2, PixelColor c)
|
||||
{
|
||||
int i;
|
||||
|
||||
// Check if the line is outside the screen for sure.
|
||||
// This is quickly done by checking in which area both points are. When this
|
||||
// is above, below, right or left of the screen, then skip drawing the line.
|
||||
if(((x1 < 0) && (x2 < 0)) ||
|
||||
((x1 > visiblewidth) && (x2 > visiblewidth)) ||
|
||||
((y1 < 0) && (y2 < 0)) ||
|
||||
((y1 > visibleheight) && (y2 > visibleheight))) return;
|
||||
|
||||
// Distance of the line
|
||||
int dx = x2 - x1;
|
||||
int dy = y2 - y1;
|
||||
|
||||
// Positive (absolute) distance
|
||||
int dxabs = Math.Abs(dx);
|
||||
int dyabs = Math.Abs(dy);
|
||||
|
||||
// Half distance
|
||||
int x = dyabs >> 1;
|
||||
int y = dxabs >> 1;
|
||||
|
||||
// Direction
|
||||
int sdx = Math.Sign(dx);
|
||||
int sdy = Math.Sign(dy);
|
||||
|
||||
// Start position
|
||||
int px = x1;
|
||||
int py = y1;
|
||||
|
||||
// Draw first pixel
|
||||
DrawPixelAlpha(px, py, c);
|
||||
|
||||
// Check if the line is more horizontal than vertical
|
||||
if(dxabs >= dyabs)
|
||||
{
|
||||
for(i = 0; i < dxabs; i++)
|
||||
{
|
||||
y += dyabs;
|
||||
if(y >= dxabs)
|
||||
{
|
||||
y -= dxabs;
|
||||
py += sdy;
|
||||
}
|
||||
px += sdx;
|
||||
|
||||
// Draw pixel
|
||||
DrawPixelAlpha(px, py, c);
|
||||
}
|
||||
}
|
||||
// Else the line is more vertical than horizontal
|
||||
else
|
||||
{
|
||||
for(i = 0; i < dyabs; i++)
|
||||
{
|
||||
x += dxabs;
|
||||
if(x >= dyabs)
|
||||
{
|
||||
x -= dyabs;
|
||||
px += sdx;
|
||||
}
|
||||
py += sdy;
|
||||
|
||||
// Draw pixel
|
||||
DrawPixelAlpha(px, py, c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This draws a line normally
|
||||
// See: http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm
|
||||
public void DrawLineSolid(int x1, int y1, int x2, int y2, PixelColor c)
|
||||
|
|
|
@ -33,6 +33,7 @@ using SlimDX;
|
|||
using CodeImp.DoomBuilder.Geometry;
|
||||
using System.Drawing.Imaging;
|
||||
using CodeImp.DoomBuilder.Data;
|
||||
using CodeImp.DoomBuilder.Editing;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -49,7 +50,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
private const float THING_CIRCLE_SIZE = 1f;
|
||||
private const float THING_CIRCLE_SHRINK = 2f;
|
||||
private const int THING_BUFFER_STEP = 100;
|
||||
private const float THINGS_BACK_ALPHA = 0.4f;
|
||||
private const float THINGS_BACK_ALPHA = 0.3f;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -74,6 +75,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
// Vertices to present the textures
|
||||
private FlatVertex[] structverts;
|
||||
private FlatVertex[] thingsverts;
|
||||
private FlatVertex[] backverts;
|
||||
|
||||
// Batch buffer for things rendering
|
||||
private VertexBuffer thingsvertices;
|
||||
|
@ -139,7 +141,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
|
||||
#endregion
|
||||
|
||||
#region ================== Displaying
|
||||
#region ================== Presenting
|
||||
|
||||
// This draws the image on screen
|
||||
public void Present()
|
||||
|
@ -151,6 +153,24 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
graphics.Device.SetRenderState(RenderState.CullMode, Cull.None);
|
||||
graphics.Device.SetRenderState(RenderState.ZEnable, false);
|
||||
|
||||
// Render a background image?
|
||||
if((backverts != null) && (General.Map.Grid.Background.Texture != null))
|
||||
{
|
||||
// Set renderstates
|
||||
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, false);
|
||||
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, true);
|
||||
graphics.Device.SetTexture(0, General.Map.Grid.Background.Texture);
|
||||
graphics.Shaders.Display2D.Texture1 = General.Map.Grid.Background.Texture;
|
||||
graphics.Shaders.Display2D.SetSettings(1f / windowsize.Width, 1f / windowsize.Height, FSAA_BLEND_FACTOR, 1f);
|
||||
|
||||
// Draw the background
|
||||
graphics.Shaders.Display2D.Begin();
|
||||
graphics.Shaders.Display2D.BeginPass(0);
|
||||
graphics.Device.DrawUserPrimitives<FlatVertex>(PrimitiveType.TriangleStrip, 0, 2, backverts);
|
||||
graphics.Shaders.Display2D.EndPass();
|
||||
graphics.Shaders.Display2D.End();
|
||||
}
|
||||
|
||||
// Render things in back?
|
||||
if(!thingsfront) PresentThings(THINGS_BACK_ALPHA);
|
||||
|
||||
|
@ -187,7 +207,6 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
//graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, false);
|
||||
//graphics.Device.SetRenderState(RenderState.AlphaTestEnable, true);
|
||||
//graphics.Device.SetRenderState(RenderState.AlphaFunc, Compare.GreaterEqual);
|
||||
//graphics.Device.SetRenderState(RenderState.AlphaRef, 0x0000007F);
|
||||
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, true);
|
||||
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, false);
|
||||
graphics.Device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha);
|
||||
|
@ -520,8 +539,6 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
// Set renderstates for things rendering
|
||||
graphics.Device.SetRenderState(RenderState.AlphaBlendEnable, false);
|
||||
graphics.Device.SetRenderState(RenderState.AlphaTestEnable, true);
|
||||
graphics.Device.SetRenderState(RenderState.AlphaFunc, Compare.GreaterEqual);
|
||||
graphics.Device.SetRenderState(RenderState.AlphaRef, 0x0000007F);
|
||||
graphics.Device.SetTexture(0, thingtexture.Texture);
|
||||
graphics.Shaders.Things2D.Texture1 = thingtexture.Texture;
|
||||
graphics.Device.SetStreamSource(0, thingsvertices, 0, FlatVertex.Stride);
|
||||
|
@ -590,7 +607,87 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region ================== Background
|
||||
|
||||
// This sets up background image vertices
|
||||
private void SetupBackground()
|
||||
{
|
||||
Vector2D ltpos, rbpos;
|
||||
Vector2D backoffset = new Vector2D((float)General.Map.Grid.BackgroundX, (float)General.Map.Grid.BackgroundY);
|
||||
Vector2D backimagesize = new Vector2D((float)General.Map.Grid.Background.Width, (float)General.Map.Grid.Background.Height);
|
||||
|
||||
// Only if a background image is set
|
||||
if((General.Map.Grid.Background != null) &&
|
||||
!(General.Map.Grid.Background is NullImage))
|
||||
{
|
||||
// Make vertices
|
||||
backverts = CreateScreenVerts(windowsize);
|
||||
|
||||
// Determine map coordinates for view window
|
||||
ltpos = GetMapCoordinates(new Vector2D(0f, 0f));
|
||||
rbpos = GetMapCoordinates(new Vector2D(windowsize.Width, windowsize.Height));
|
||||
|
||||
// Offset by given background offset
|
||||
ltpos -= backoffset;
|
||||
rbpos -= backoffset;
|
||||
|
||||
// Calculate UV coordinates
|
||||
// NOTE: backimagesize.y is made negative to match Doom's coordinate system
|
||||
backverts[0].u = ltpos.x / backimagesize.x;
|
||||
backverts[0].v = ltpos.y / -backimagesize.y;
|
||||
backverts[1].u = rbpos.x / backimagesize.x;
|
||||
backverts[1].v = ltpos.y / -backimagesize.y;
|
||||
backverts[2].u = ltpos.x / backimagesize.x;
|
||||
backverts[2].v = rbpos.y / -backimagesize.y;
|
||||
backverts[3].u = rbpos.x / backimagesize.x;
|
||||
backverts[3].v = rbpos.y / -backimagesize.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
// No background image
|
||||
backverts = null;
|
||||
}
|
||||
}
|
||||
|
||||
// This renders the grid
|
||||
private void RenderGrid(float size, PixelColor c)
|
||||
{
|
||||
Vector2D ltpos, rbpos;
|
||||
Vector2D pos = new Vector2D();
|
||||
float sizeinv = 1f / size;
|
||||
|
||||
// Only render grid when not screen-filling
|
||||
if((size * scale) > 6f)
|
||||
{
|
||||
// Determine map coordinates for view window
|
||||
ltpos = GetMapCoordinates(new Vector2D(0, 0));
|
||||
rbpos = GetMapCoordinates(new Vector2D(windowsize.Width, windowsize.Height));
|
||||
|
||||
// Clip to nearest grid
|
||||
ltpos = GridSetup.SnappedToGrid(ltpos, size, sizeinv);
|
||||
rbpos = GridSetup.SnappedToGrid(rbpos, size, sizeinv);
|
||||
|
||||
// Draw all horizontal grid lines
|
||||
for(float y = ltpos.y + size; y > rbpos.y - size; y -= size)
|
||||
{
|
||||
pos.y = y;
|
||||
pos = pos.GetTransformed(translatex, translatey, scale, -scale);
|
||||
plotter.DrawGridLineH((int)pos.y, c);
|
||||
}
|
||||
|
||||
// Draw all vertical grid lines
|
||||
for(float x = ltpos.x - size; x < rbpos.x + size; x += size)
|
||||
{
|
||||
pos.x = x;
|
||||
pos = pos.GetTransformed(translatex, translatey, scale, -scale);
|
||||
plotter.DrawGridLineV((int)pos.x, c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Rendering
|
||||
|
||||
// This begins a drawing session
|
||||
|
@ -606,12 +703,25 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
plotter = new Plotter((PixelColor*)structlocked.Data.DataPointer.ToPointer(), structlocked.Pitch / sizeof(PixelColor), structsize.Height, structsize.Width, structsize.Height);
|
||||
if(clearstructs) plotter.Clear();
|
||||
|
||||
// Redraw grid when structures image was cleared
|
||||
if(clearstructs)
|
||||
{
|
||||
// Render normal grid
|
||||
RenderGrid(General.Map.Grid.GridSize, General.Colors.Grid);
|
||||
|
||||
// Render 64 grid
|
||||
if(General.Map.Grid.GridSize <= 64) RenderGrid(64f, General.Colors.Grid64);
|
||||
}
|
||||
|
||||
// Always trash things batch buffer
|
||||
if(thingsvertices != null) thingsvertices.Dispose();
|
||||
thingsvertices = null;
|
||||
numthings = 0;
|
||||
maxthings = 0;
|
||||
|
||||
// Setup vertices for background image
|
||||
SetupBackground();
|
||||
|
||||
// Set the rendertarget to the things texture
|
||||
thingssurface = thingstex.GetSurfaceLevel(0);
|
||||
if(graphics.StartRendering(clearthings, 0, thingssurface, null))
|
||||
|
|
|
@ -71,7 +71,7 @@ savemapinto
|
|||
mapoptions
|
||||
{
|
||||
title = "Edit: Map Options";
|
||||
description = "Shows the map options dialog which allows changing the map lump name, game configuration and custom resources.";
|
||||
description = "Shows the Map Options dialog which allows changing the map lump name, game configuration and custom resources.";
|
||||
allowkeys = true;
|
||||
allowmouse = false;
|
||||
allowscroll = false;
|
||||
|
@ -134,7 +134,7 @@ zoomout
|
|||
configuration
|
||||
{
|
||||
title = "Tools: Game Configurations";
|
||||
description = "Shows the game configurations dialog which allows you to configure settings such as nodebuilder, testing program and resources.";
|
||||
description = "Shows the Game Configurations dialog which allows you to configure settings such as nodebuilder, testing program and resources.";
|
||||
allowkeys = true;
|
||||
allowmouse = false;
|
||||
allowscroll = false;
|
||||
|
@ -143,7 +143,7 @@ configuration
|
|||
preferences
|
||||
{
|
||||
title = "Tools: Preferences";
|
||||
description = "Shows this preferences dialog.";
|
||||
description = "Shows this Preferences dialog.";
|
||||
allowkeys = true;
|
||||
allowmouse = false;
|
||||
allowscroll = false;
|
||||
|
@ -202,3 +202,12 @@ cancelmode
|
|||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
}
|
||||
|
||||
gridsetup
|
||||
{
|
||||
title = "View: Grid Setup";
|
||||
description = "Shows the Custom Grid Setup dialog which allows you to set custom grid sizes and a background image.";
|
||||
allowkeys = true;
|
||||
allowmouse = false;
|
||||
allowscroll = false;
|
||||
}
|
||||
|
|
BIN
Source/Resources/Grid2.png
Normal file
BIN
Source/Resources/Grid2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 173 B |
Loading…
Reference in a new issue