mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-24 04:41:10 +00:00
7c93fad714
Added drawing modes to Mode menu, so they are much easier to spot now. Warnings notify panel blinks much more noticeable when there are warnings. UDMF Controls plugin: 3D-floor surfaces can be edited now. Relative mode is now enabled by default. Scale control now works properly in relative mode. Angle control's angle indicator in now drawn properly when value is changed using numeric control.
105 lines
3.6 KiB
C#
105 lines
3.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Drawing;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
using CodeImp.DoomBuilder.Plugins;
|
|
using CodeImp.DoomBuilder.Actions;
|
|
using CodeImp.DoomBuilder.Windows;
|
|
using CodeImp.DoomBuilder.VisualModes;
|
|
|
|
namespace CodeImp.DoomBuilder.UDMFControls
|
|
{
|
|
public class BuilderPlug: Plug {
|
|
private static BuilderPlug me;
|
|
public static BuilderPlug Me { get { return me; } }
|
|
|
|
public override string Name { get { return "UDMF Controls"; } }
|
|
|
|
private UDMFControlsForm form;
|
|
|
|
private Point formLocation; //used to keep form's location constant
|
|
|
|
public override void OnInitialize() {
|
|
if (GZBuilder.GZGeneral.Version < 1.09f) {
|
|
General.ErrorLogger.Add(ErrorType.Error, "UDMFControls plugin: GZDoomBuilder 1.09 or later required!");
|
|
return;
|
|
}
|
|
|
|
base.OnInitialize();
|
|
me = this;
|
|
|
|
General.Actions.BindMethods(this);
|
|
}
|
|
|
|
/*public override void OnEditKeyDown(KeyEventArgs e) {
|
|
//dbg
|
|
GZBuilder.GZGeneral.Trace("OnEditKeyDown");
|
|
|
|
base.OnEditKeyDown(e);
|
|
if(form != null){
|
|
form.FineMovement = General.Interface.ShiftState;
|
|
form.FastMovement = General.Interface.CtrlState;
|
|
}
|
|
}
|
|
|
|
public override void OnEditKeyUp(KeyEventArgs e) {
|
|
base.OnEditKeyUp(e);
|
|
if (form != null) {
|
|
form.FineMovement = General.Interface.ShiftState;
|
|
form.FastMovement = General.Interface.CtrlState;
|
|
}
|
|
}*/
|
|
|
|
public override void Dispose() {
|
|
base.Dispose();
|
|
General.Actions.UnbindMethods(this);
|
|
|
|
if (form != null) form.Close();
|
|
form = null;
|
|
}
|
|
|
|
[BeginAction("openudmfcontrols")]
|
|
private void openControls() {
|
|
if (General.Editing.Mode == null)
|
|
return;
|
|
|
|
if (!GZBuilder.GZGeneral.UDMF) {
|
|
General.Interface.DisplayStatus(StatusType.Warning, "Map in UDMF format required!");
|
|
return;
|
|
}
|
|
|
|
List<VisualGeometry> selectedSurfaces;
|
|
|
|
if (General.Editing.Mode.GetType().Name == "BaseVisualMode") {
|
|
selectedSurfaces = ((VisualMode)General.Editing.Mode).GetSelectedSurfaces();
|
|
if (selectedSurfaces.Count == 0) {
|
|
General.Interface.DisplayStatus(StatusType.Warning, "Select some surfaces first!");
|
|
return;
|
|
}
|
|
} else {//wrong mode
|
|
General.Interface.DisplayStatus(StatusType.Warning, "Switch to Visual Mode first!");
|
|
return;
|
|
}
|
|
|
|
//show form
|
|
form = new UDMFControlsForm();
|
|
if (formLocation.X == 0 && formLocation.Y == 0) {
|
|
Size displaySize = Plug.DisplaySize;
|
|
Point displayLocation = Plug.DisplayLocationAbs;
|
|
formLocation = new Point(displayLocation.X + displaySize.Width - form.Width - 16, displayLocation.Y + 32);
|
|
}
|
|
form.Location = formLocation;
|
|
form.FormClosed += new FormClosedEventHandler(form_FormClosed);
|
|
form.Setup(selectedSurfaces);
|
|
form.ShowDialog(Form.ActiveForm);
|
|
}
|
|
|
|
private void form_FormClosed(object sender, FormClosedEventArgs e) {
|
|
formLocation = form.Location;
|
|
form.Dispose();
|
|
form = null;
|
|
}
|
|
}
|
|
}
|