mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-23 20:32:34 +00:00
13c3155db5
Added "Paste Properties Special" actions in "Classic" and "Visual" categories. They work the same way as "Paste Special" action. Added: "Copy Properties", "Paste Properties" and "Paste Properties Special" options are now shown in the Edit menu if current classic mode supports them. Changed, Paste Properties Special window: only options relevant to current map format are now displayed. Changed, Paste Properties Special window, UDMF: all UI-managed options are now available. Fixed: MAPINFO parser was unable to process "include" directives. Fixed, General interface: selection info was reset to "Nothing selected" after few seconds regardless of current selection. Fixed, Visual mode: thing bounding boxes were not updated when changing things positions using Randomize mode. Fixed, Visual mode: event lines were displayed at incorrect height when entering Visual mode for the first time. Fixed, Texture Browser window: when MixTexturesFlats Game Configuration option is disabled, textures/flats are no longer shown in the Used group when flats/textures with the same names are used in the map. Fixed(?): probably fixed an exception some users reported when trying to initialize a Classic mode after switching from Visual mode with "Sync cameras" option enabled. Changed, Game configurations, Thing Categories: a block must have at least one thing category property to be recognized as a thing category. Changed, Visplane Explorer: the plugin now outputs more info when it fails to initialize vpo.dll. Cosmetic, Thing Edit window, Doom/Hexen map format: adjusted UI layout so thing flags control no longer displays scrollbars in Hexen map format. Internal: merged methods from UDMFTools into UniFields, removed UDMFTools. Updated Inno Setup script (added VC++ 2008 SP1 distributive). Updated ZDoom_DECORATE.cfg (A_CheckBlock). Updated documentation (added "System Requirements" page).
148 lines
3.6 KiB
C#
148 lines
3.6 KiB
C#
#region ================== Copyright
|
|
|
|
/*
|
|
* Made by MaxED, mkay?
|
|
*/
|
|
|
|
#endregion
|
|
|
|
#region ================== Namespaces
|
|
|
|
using System;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
using CodeImp.DoomBuilder.Map;
|
|
using CodeImp.DoomBuilder.Rendering;
|
|
|
|
#endregion
|
|
|
|
namespace CodeImp.DoomBuilder.Controls
|
|
{
|
|
public partial class CommentEditor : UserControl
|
|
{
|
|
#region ================== Variables
|
|
|
|
private const string DEFAULT_TEXT = "Click to enter a comment...";
|
|
private bool mixedvalues;
|
|
private int commenttype;
|
|
|
|
#endregion
|
|
|
|
#region ================== Constructor / Disposer
|
|
|
|
public CommentEditor()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region ================== Methods
|
|
|
|
public void SetValues(UniFields fields, bool first)
|
|
{
|
|
if(mixedvalues) return;
|
|
string c = fields.GetValue("comment", string.Empty);
|
|
if(first)
|
|
{
|
|
textbox.Text = c;
|
|
}
|
|
else if(textbox.Text != c)
|
|
{
|
|
textbox.Clear();
|
|
mixedvalues = true;
|
|
}
|
|
}
|
|
|
|
public void FinishSetup()
|
|
{
|
|
if(mixedvalues) return;
|
|
|
|
if(string.IsNullOrEmpty(textbox.Text))
|
|
{
|
|
textbox.Text = DEFAULT_TEXT;
|
|
textbox.ForeColor = SystemColors.InactiveCaptionText;
|
|
radioButton1.Checked = true;
|
|
}
|
|
else if(textbox.Text.Length > 2)
|
|
{
|
|
string type = textbox.Text.Substring(0, 3);
|
|
int index = Array.IndexOf(CommentType.Types, type);
|
|
commenttype = (index > 0 ? index : 0);
|
|
if(commenttype > 0) textbox.Text = textbox.Text.TrimStart(type.ToCharArray());
|
|
|
|
// Isn't there a better way to do this?..
|
|
switch(commenttype)
|
|
{
|
|
case 0: radioButton1.Checked = true; break;
|
|
case 1: radioButton2.Checked = true; break;
|
|
case 2: radioButton3.Checked = true; break;
|
|
case 3: radioButton4.Checked = true; break;
|
|
case 4: radioButton5.Checked = true; break;
|
|
}
|
|
}
|
|
}
|
|
|
|
public void Apply(UniFields fields)
|
|
{
|
|
if(mixedvalues) return;
|
|
string text = (!string.IsNullOrEmpty(textbox.Text) && textbox.Text != DEFAULT_TEXT ? CommentType.Types[commenttype] + textbox.Text : String.Empty);
|
|
UniFields.SetString(fields, "comment", text, string.Empty);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region ================== Events
|
|
|
|
private void clear_Click(object sender, EventArgs e)
|
|
{
|
|
textbox.Text = DEFAULT_TEXT;
|
|
textbox.ForeColor = SystemColors.InactiveCaptionText;
|
|
mixedvalues = false;
|
|
}
|
|
|
|
private void textbox_Enter(object sender, EventArgs e)
|
|
{
|
|
if(textbox.Text == DEFAULT_TEXT)
|
|
{
|
|
textbox.Clear();
|
|
textbox.ForeColor = SystemColors.WindowText;
|
|
}
|
|
}
|
|
|
|
private void textbox_Leave(object sender, EventArgs e)
|
|
{
|
|
if(string.IsNullOrEmpty(textbox.Text) && !mixedvalues)
|
|
{
|
|
textbox.Text = DEFAULT_TEXT;
|
|
textbox.ForeColor = SystemColors.InactiveCaptionText;
|
|
}
|
|
}
|
|
|
|
private void textbox_TextChanged(object sender, EventArgs e)
|
|
{
|
|
mixedvalues = false;
|
|
}
|
|
|
|
private void radiobutton_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
commenttype = (int)((Control)sender).Tag;
|
|
}
|
|
|
|
// We don't want to close the parent form when user presses Enter while typing the text
|
|
private void textbox_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
|
|
{
|
|
if(e.KeyCode == Keys.Enter) e.IsInputKey = true;
|
|
}
|
|
|
|
//mxd. Because anchor-based alignment fails when using high-Dpi settings...
|
|
private void CommentEditor_Resize(object sender, EventArgs e)
|
|
{
|
|
clear.Left = this.Width - clear.Margin.Right - clear.Width;
|
|
textbox.Width = this.Width - textbox.Left - textbox.Margin.Right;
|
|
textbox.Height = this.Height - textbox.Top - textbox.Margin.Bottom;
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|