mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 22:41:46 +00:00
Added Edit Selection Mode docker panel to view and modify transformation values manually
This commit is contained in:
parent
1f73d1a105
commit
02290d6898
2 changed files with 103 additions and 1 deletions
|
@ -224,6 +224,10 @@
|
||||||
<None Include="Resources\FlipSelectionV.png" />
|
<None Include="Resources\FlipSelectionV.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Interface\EditSelectionPanel.resx">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<DependentUpon>EditSelectionPanel.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="Interface\UndoRedoPanel.resx">
|
<EmbeddedResource Include="Interface\UndoRedoPanel.resx">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<DependentUpon>UndoRedoPanel.cs</DependentUpon>
|
<DependentUpon>UndoRedoPanel.cs</DependentUpon>
|
||||||
|
@ -254,6 +258,12 @@
|
||||||
<Compile Include="FindReplace\FindThingType.cs" />
|
<Compile Include="FindReplace\FindThingType.cs" />
|
||||||
<Compile Include="FindReplace\FindVertexNumber.cs" />
|
<Compile Include="FindReplace\FindVertexNumber.cs" />
|
||||||
<Compile Include="General\UndoGroup.cs" />
|
<Compile Include="General\UndoGroup.cs" />
|
||||||
|
<Compile Include="Interface\EditSelectionPanel.cs">
|
||||||
|
<SubType>UserControl</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Interface\EditSelectionPanel.Designer.cs">
|
||||||
|
<DependentUpon>EditSelectionPanel.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Interface\UndoRedoPanel.cs">
|
<Compile Include="Interface\UndoRedoPanel.cs">
|
||||||
<SubType>UserControl</SubType>
|
<SubType>UserControl</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
|
@ -34,6 +34,7 @@ using CodeImp.DoomBuilder.Actions;
|
||||||
using CodeImp.DoomBuilder.Types;
|
using CodeImp.DoomBuilder.Types;
|
||||||
using CodeImp.DoomBuilder.Config;
|
using CodeImp.DoomBuilder.Config;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using CodeImp.DoomBuilder.Controls;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -90,6 +91,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
private bool pasting = false;
|
private bool pasting = false;
|
||||||
private PasteOptions pasteoptions;
|
private PasteOptions pasteoptions;
|
||||||
|
|
||||||
|
// Docker
|
||||||
|
private EditSelectionPanel panel;
|
||||||
|
private Docker docker;
|
||||||
|
|
||||||
// Highlighted vertex
|
// Highlighted vertex
|
||||||
private MapElement highlighted;
|
private MapElement highlighted;
|
||||||
private Vector2D highlightedpos;
|
private Vector2D highlightedpos;
|
||||||
|
@ -175,6 +180,71 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
|
|
||||||
#region ================== Methods
|
#region ================== Methods
|
||||||
|
|
||||||
|
// The following functions set different properties and update
|
||||||
|
|
||||||
|
public void SetAbsPosX(float posx)
|
||||||
|
{
|
||||||
|
offset.x = posx;
|
||||||
|
UpdateAllChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetAbsPosY(float posy)
|
||||||
|
{
|
||||||
|
offset.y = posy;
|
||||||
|
UpdateAllChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetRelPosX(float posx)
|
||||||
|
{
|
||||||
|
offset.x = posx + baseoffset.x;
|
||||||
|
UpdateAllChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetRelPosY(float posy)
|
||||||
|
{
|
||||||
|
offset.y = posy + baseoffset.y;
|
||||||
|
UpdateAllChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetAbsSizeX(float sizex)
|
||||||
|
{
|
||||||
|
size.x = sizex;
|
||||||
|
UpdateAllChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetAbsSizeY(float sizey)
|
||||||
|
{
|
||||||
|
size.y = sizey;
|
||||||
|
UpdateAllChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetRelSizeX(float sizex)
|
||||||
|
{
|
||||||
|
size.x = basesize.x * (sizex / 100.0f);
|
||||||
|
UpdateAllChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetRelSizeY(float sizey)
|
||||||
|
{
|
||||||
|
size.y = basesize.y * (sizey / 100.0f);
|
||||||
|
UpdateAllChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetAbsRotation(float absrot)
|
||||||
|
{
|
||||||
|
rotation = absrot;
|
||||||
|
UpdateAllChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
// This updates all after changes were made
|
||||||
|
private void UpdateAllChanges()
|
||||||
|
{
|
||||||
|
UpdateGeometry();
|
||||||
|
UpdateRectangleComponents();
|
||||||
|
General.Map.Map.Update();
|
||||||
|
General.Interface.RedrawDisplay();
|
||||||
|
}
|
||||||
|
|
||||||
// This returns the position of the highlighted item
|
// This returns the position of the highlighted item
|
||||||
private Vector2D GetHighlightedPosition()
|
private Vector2D GetHighlightedPosition()
|
||||||
{
|
{
|
||||||
|
@ -548,6 +618,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
{
|
{
|
||||||
return (point.x >= rect.Left) && (point.x <= rect.Right) && (point.y >= rect.Top) && (point.y <= rect.Bottom);
|
return (point.x >= rect.Left) && (point.x <= rect.Right) && (point.y >= rect.Top) && (point.y <= rect.Bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This updates the values in the panel
|
||||||
|
private void UpdatePanel()
|
||||||
|
{
|
||||||
|
Vector2D relsize = (size / basesize) * 100.0f;
|
||||||
|
if(panel != null)
|
||||||
|
panel.ShowCurrentValues(offset, offset - baseoffset, size, relsize, rotation);
|
||||||
|
}
|
||||||
|
|
||||||
// This moves all things and vertices to match the current transformation
|
// This moves all things and vertices to match the current transformation
|
||||||
private void UpdateGeometry()
|
private void UpdateGeometry()
|
||||||
|
@ -569,6 +647,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
bool shouldbeflipped = (size.x < 0.0f) ^ (size.y < 0.0f);
|
bool shouldbeflipped = (size.x < 0.0f) ^ (size.y < 0.0f);
|
||||||
if(shouldbeflipped != linesflipped) FlipLinedefs();
|
if(shouldbeflipped != linesflipped) FlipLinedefs();
|
||||||
|
|
||||||
|
UpdatePanel();
|
||||||
General.Map.Map.Update(true, false);
|
General.Map.Map.Update(true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -672,13 +751,19 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
public override void OnEngage()
|
public override void OnEngage()
|
||||||
{
|
{
|
||||||
base.OnEngage();
|
base.OnEngage();
|
||||||
|
|
||||||
bool autodrag = (pasting && mouseinside && BuilderPlug.Me.AutoDragOnPaste);
|
bool autodrag = (pasting && mouseinside && BuilderPlug.Me.AutoDragOnPaste);
|
||||||
|
|
||||||
// Add toolbar buttons
|
// Add toolbar buttons
|
||||||
General.Interface.AddButton(BuilderPlug.Me.MenusForm.FlipSelectionH);
|
General.Interface.AddButton(BuilderPlug.Me.MenusForm.FlipSelectionH);
|
||||||
General.Interface.AddButton(BuilderPlug.Me.MenusForm.FlipSelectionV);
|
General.Interface.AddButton(BuilderPlug.Me.MenusForm.FlipSelectionV);
|
||||||
|
|
||||||
|
// Add docker
|
||||||
|
panel = new EditSelectionPanel(this);
|
||||||
|
docker = new Docker("editselection", "Edit Selection", panel);
|
||||||
|
General.Interface.AddDocker(docker);
|
||||||
|
General.Interface.SelectDocker(docker);
|
||||||
|
|
||||||
// We don't want to record this for undoing while we move the geometry around.
|
// We don't want to record this for undoing while we move the geometry around.
|
||||||
// This will be set back to normal when we're done.
|
// This will be set back to normal when we're done.
|
||||||
General.Map.UndoRedo.IgnorePropChanges = true;
|
General.Map.UndoRedo.IgnorePropChanges = true;
|
||||||
|
@ -799,7 +884,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
renderer.SetPresentation(Presentation.Standard);
|
renderer.SetPresentation(Presentation.Standard);
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
|
panel.ShowOriginalValues(baseoffset, basesize);
|
||||||
UpdateRectangleComponents();
|
UpdateRectangleComponents();
|
||||||
|
UpdatePanel();
|
||||||
Update();
|
Update();
|
||||||
|
|
||||||
// When pasting and mouse is in screen, drag selection immediately
|
// When pasting and mouse is in screen, drag selection immediately
|
||||||
|
@ -1040,6 +1127,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.FlipSelectionH);
|
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.FlipSelectionH);
|
||||||
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.FlipSelectionV);
|
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.FlipSelectionV);
|
||||||
|
|
||||||
|
// Remove docker
|
||||||
|
General.Interface.RemoveDocker(docker);
|
||||||
|
panel.Dispose();
|
||||||
|
panel = null;
|
||||||
|
|
||||||
// When not cancelled manually, we assume it is accepted
|
// When not cancelled manually, we assume it is accepted
|
||||||
if(!cancelled)
|
if(!cancelled)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue