UltimateZoneBuilder/Source/Core/Windows/CustomFieldsForm.cs
MaxED 724709e435 Visual mode: added "Look Through Selection" action (default key is "Y"). This action places visual camera at the same position as selected/highlighted thing and rotates it to match thing's angle. Special handling is available if targeted thing is AimingCamera, MovingCamera or SecurityCamera.
Script editor: pressing "F1" now opens keyword help instead of program manual.
Linedef edit form, Thing edit form: rewritten script support logic. It should now work in the same manner as the rest of controls.
Thing info panel: thing arguments now have proper labels.
Edit forms, UDMF: fields, which are handled by UI, are no longer shown in "Custom" tab.
Visual mode: fixed a crash when loading a model on a video card without Shader model 2.0 support.
Fixed incorrect argument number and changed most of labels in "Cameras and interpolation" section of zdoom_things.cfg.
2013-08-08 11:04:13 +00:00

104 lines
2.8 KiB
C#

#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.Windows.Forms;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Map;
#endregion
namespace CodeImp.DoomBuilder.Windows
{
/// <summary>
/// Dialog window that allows you to view and/or change custom UDMF fields.
/// </summary>
public partial class CustomFieldsForm : DelayedForm
{
// Keep a list of elements
private ICollection<MapElement> elements;
// Constructor
public CustomFieldsForm()
{
// Initialize
InitializeComponent();
}
// This shows the dialog, returns false when cancelled
public static bool ShowDialog(IWin32Window owner, string title, string elementname, ICollection<MapElement> elements, List<UniversalFieldInfo> fixedfields)
{
bool result;
CustomFieldsForm f = new CustomFieldsForm();
f.Setup(title, elementname, elements, fixedfields);
result = (f.ShowDialog(owner) == DialogResult.OK);
f.Dispose();
return result;
}
// This sets up the dialog
public void Setup(string title, string elementname, ICollection<MapElement> elements, List<UniversalFieldInfo> fixedfields)
{
// Initialize
this.elements = elements;
this.Text = title;
// Initialize custom fields editor
fieldslist.Setup(elementname);
// Fill universal fields list
fieldslist.ListFixedFields(fixedfields);
// Setup from first element
MapElement fe = General.GetByIndex(elements, 0);
fieldslist.SetValues(fe.Fields, true);
// Setup from all elements
foreach(MapElement e in elements)
fieldslist.SetValues(e.Fields, false);
}
// OK clicked
private void apply_Click(object sender, EventArgs e)
{
// Apply fields to all elements
foreach(MapElement el in elements) fieldslist.Apply(el.Fields);
// Done
General.Map.IsChanged = true;
this.DialogResult = DialogResult.OK;
this.Close();
}
// Cancel clicked
private void cancel_Click(object sender, EventArgs e)
{
// Be gone
this.DialogResult = DialogResult.Cancel;
this.Close();
}
// Help requested
private void CustomFieldsForm_HelpRequested(object sender, HelpEventArgs hlpevent)
{
General.ShowHelp("w_customfields.html");
hlpevent.Handled = true;
}
}
}