Things are now rendered behind grid and linedefs/vertices when they are dragged.

Added hints for Drag Geometry modes.
This commit is contained in:
MaxED 2013-12-23 12:02:58 +00:00
parent 6a51cc7c01
commit 87ff11cc0f
13 changed files with 99 additions and 64 deletions

View file

@ -144,6 +144,7 @@ namespace CodeImp.DoomBuilder.Editing
}
SetupHints(); //mxd
SetupMultiselectionHints(); //mxd
}
// Disposer
@ -814,6 +815,12 @@ namespace CodeImp.DoomBuilder.Editing
/// </summary>
protected virtual void SetupHints() { //mxd
hints = new[] { "Press F1 to view help about current editing mode" };
}
/// <summary>
/// Override this to setup hints shown while multiselecting for this editing mode
/// </summary>
protected virtual void SetupMultiselectionHints() { //mxd
multiselectionHints = new[] { "Press F1 to view help about current editing mode" };
}

View file

@ -34,10 +34,12 @@ namespace CodeImp.DoomBuilder.Rendering
// Static instances
private static Presentation standard;
private static Presentation things;
private static Presentation dragThings; //mxd
// Static properties
public static Presentation Standard { get { return standard; } }
public static Presentation Things { get { return things; } }
public static Presentation DragThings { get { return dragThings; } } //mxd
// Variables
protected internal List<PresentLayer> layers;
@ -75,6 +77,15 @@ namespace CodeImp.DoomBuilder.Rendering
things.layers.Add(new PresentLayer(RendererLayer.Geometry, BlendingMode.Alpha, 1f, true));
things.layers.Add(new PresentLayer(RendererLayer.Things, BlendingMode.Alpha, 1f, false));
things.layers.Add(new PresentLayer(RendererLayer.Overlay, BlendingMode.Alpha, 1f, true));
//mxd. Drag things in Classic mode
dragThings = new Presentation();
dragThings.layers.Add(new PresentLayer(RendererLayer.Background, BlendingMode.Mask, General.Settings.BackgroundAlpha));
dragThings.layers.Add(new PresentLayer(RendererLayer.Surface, BlendingMode.Mask));
dragThings.layers.Add(new PresentLayer(RendererLayer.Things, BlendingMode.Alpha, 1f, false));
dragThings.layers.Add(new PresentLayer(RendererLayer.Grid, BlendingMode.Mask));
dragThings.layers.Add(new PresentLayer(RendererLayer.Geometry, BlendingMode.Alpha, 1f, true));
dragThings.layers.Add(new PresentLayer(RendererLayer.Overlay, BlendingMode.Alpha, 1f, true));
}
}

View file

@ -77,6 +77,8 @@ namespace CodeImp.DoomBuilder.Windows
this.fieldslist = new CodeImp.DoomBuilder.Controls.FieldsEditorControl();
this.cancel = new System.Windows.Forms.Button();
this.apply = new System.Windows.Forms.Button();
this.hint = new System.Windows.Forms.PictureBox();
this.hintlabel = new System.Windows.Forms.Label();
groupBox1 = new System.Windows.Forms.GroupBox();
groupBox2 = new System.Windows.Forms.GroupBox();
label7 = new System.Windows.Forms.Label();
@ -90,6 +92,7 @@ namespace CodeImp.DoomBuilder.Windows
this.hexenpanel.SuspendLayout();
this.groupBox3.SuspendLayout();
this.tabcustom.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.hint)).BeginInit();
this.SuspendLayout();
//
// groupBox1
@ -671,6 +674,24 @@ namespace CodeImp.DoomBuilder.Windows
this.apply.UseVisualStyleBackColor = true;
this.apply.Click += new System.EventHandler(this.apply_Click);
//
// hint
//
this.hint.Image = global::CodeImp.DoomBuilder.Properties.Resources.Lightbulb;
this.hint.Location = new System.Drawing.Point(10, 433);
this.hint.Name = "hint";
this.hint.Size = new System.Drawing.Size(16, 16);
this.hint.TabIndex = 3;
this.hint.TabStop = false;
//
// hintlabel
//
this.hintlabel.AutoSize = true;
this.hintlabel.Location = new System.Drawing.Point(28, 434);
this.hintlabel.Name = "hintlabel";
this.hintlabel.Size = new System.Drawing.Size(310, 14);
this.hintlabel.TabIndex = 4;
this.hintlabel.Text = "Select several thing types to randomly assign them to selection";
//
// ThingEditForm
//
this.AcceptButton = this.apply;
@ -678,6 +699,8 @@ namespace CodeImp.DoomBuilder.Windows
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.CancelButton = this.cancel;
this.ClientSize = new System.Drawing.Size(680, 461);
this.Controls.Add(this.hintlabel);
this.Controls.Add(this.hint);
this.Controls.Add(this.cancel);
this.Controls.Add(this.apply);
this.Controls.Add(this.tabs);
@ -706,7 +729,9 @@ namespace CodeImp.DoomBuilder.Windows
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.tabcustom.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.hint)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
@ -758,5 +783,7 @@ namespace CodeImp.DoomBuilder.Windows
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox gravity;
private System.Windows.Forms.Label labelGravity;
private CodeImp.DoomBuilder.GZBuilder.Controls.AngleControl anglecontrol;
private System.Windows.Forms.PictureBox hint;
private System.Windows.Forms.Label hintlabel;
}
}

View file

@ -159,13 +159,13 @@ namespace CodeImp.DoomBuilder.Windows
// This sets up the form to edit the given things
public void Setup(ICollection<Thing> things)
{
Thing ft;
preventchanges = true;
// Keep this list
this.things = things;
if(things.Count > 1) this.Text = "Edit Things (" + things.Count + ")";
if (things.Count > 1) this.Text = "Edit Things (" + things.Count + ")";
hint.Visible = things.Count > 1; //mxd
hintlabel.Visible = things.Count > 1; //mxd
//mxd. Make undo
string undodesc = "thing";
@ -176,7 +176,7 @@ namespace CodeImp.DoomBuilder.Windows
// Set all options to the first thing properties
////////////////////////////////////////////////////////////////////////
ft = General.GetByIndex(things, 0);
Thing ft = General.GetByIndex(things, 0);
// Set type
thingtype.SelectType(ft.Type);

View file

@ -138,6 +138,21 @@
<metadata name="actiongroup.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="hexenpanel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg1label.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg0label.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg2label.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="doompanel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="groupBox3.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@ -147,43 +162,4 @@
<metadata name="fieldslist.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="actiongroup.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="hexenpanel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="doompanel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="hexenpanel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg1label.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg0label.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg2label.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg1label.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg0label.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg2label.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="doompanel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="groupBox3.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="fieldslist.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View file

@ -464,12 +464,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
// This checks if the view offset/zoom changed and updates the check
protected bool CheckViewChanged()
{
bool viewchanged = false;
// View changed?
if(renderer.OffsetX != lastoffsetx) viewchanged = true;
if(renderer.OffsetY != lastoffsety) viewchanged = true;
if(renderer.Scale != lastscale) viewchanged = true;
bool viewchanged = (renderer.OffsetX != lastoffsetx || renderer.OffsetY != lastoffsety || renderer.Scale != lastscale);
// Keep view information
lastoffsetx = renderer.OffsetX;
@ -503,6 +499,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
}
//mxd
protected override void SetupHints() {
hints = new[] { "Hold Shift to " + (General.Interface.SnapToGrid ? "disable" : "enable") + " grid snapping.",
"Hold Ctrl to " + (General.Interface.AutoMerge ? "disable" : "enable") + " snapping to nearest vertex."
};
}
// When edit button is released
protected override void OnEditEnd()
{

View file

@ -125,13 +125,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
// This redraws the display
public override void OnRedrawDisplay()
{
bool viewchanged = CheckViewChanged();
renderer.RedrawSurface();
UpdateRedraw();
if(viewchanged)
if(CheckViewChanged())
{
// Start rendering things
if(renderer.StartThings(true))

View file

@ -130,14 +130,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
// This redraws the display
public override void OnRedrawDisplay()
{
bool viewchanged = CheckViewChanged();
renderer.RedrawSurface();
UpdateRedraw();
// Redraw things when view changed
if(viewchanged)
if(CheckViewChanged())
{
if(renderer.StartThings(true))
{

View file

@ -100,7 +100,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Just keep the base mode button checked
public override string EditModeButtonName { get { return basemode.GetType().Name; } }
internal EditMode BaseMode { get { return basemode; } }
//internal EditMode BaseMode { get { return basemode; } }
#endregion
@ -250,9 +250,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// This redraws the display
public override void OnRedrawDisplay()
{
bool viewchanged = CheckViewChanged();
if(viewchanged)
if(CheckViewChanged())
{
renderer.RedrawSurface();
@ -315,7 +313,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public override void OnEngage()
{
base.OnEngage();
renderer.SetPresentation(Presentation.Things);
renderer.SetPresentation(Presentation.DragThings); //mxd
}
// Disenagaging
@ -371,12 +369,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
// This checks if the view offset/zoom changed and updates the check
private bool CheckViewChanged()
{
bool viewchanged = false;
// View changed?
if(renderer.OffsetX != lastoffsetx) viewchanged = true;
if(renderer.OffsetY != lastoffsety) viewchanged = true;
if(renderer.Scale != lastscale) viewchanged = true;
bool viewchanged = (renderer.OffsetX != lastoffsetx || renderer.OffsetY != lastoffsety || renderer.Scale != lastscale);
// Keep view information
lastoffsetx = renderer.OffsetX;
@ -439,6 +433,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
}
//mxd
protected override void SetupHints() {
hints = new[] { "Hold Shift to "+(General.Interface.SnapToGrid ? "disable" : "enable")+ " grid snapping.",
"Hold Ctrl to snap to nearest vertex."
};
}
// When edit button is released
protected override void OnEditEnd()
{

View file

@ -278,7 +278,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
"Use " + gridIncKey + " and " + gridDecKey + " to change grid size",
"Press " + drawKey + " or " + insertKey + " to start drawing lines",
};
}
//mxd
protected override void SetupMultiselectionHints() {
multiselectionHints = new[] { "Hold Shift to " + (BuilderPlug.Me.AdditiveSelect ? "disable" : "enable") + " additive selection",
"Hold Ctrl to enable subtractive selection",
"Hold Ctrl-Shift to intersect the new selection with already existing one",

View file

@ -546,6 +546,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
"Press " + drawKey + " or " + insertKey + " to start drawing lines",
};
}
//mxd
protected override void SetupMultiselectionHints() {
multiselectionHints = new[] { "Hold Shift to " + (BuilderPlug.Me.AdditiveSelect ? "disable" : "enable") + " additive selection",
"Hold Ctrl to enable subtractive selection",
"Hold Ctrl-Shift to intersect the new selection with already existing one",

View file

@ -657,7 +657,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
"Press " + insertKey + " to create a new thing",
"Press " + drawKey + " to start drawing lines",
};
}
//mxd
protected override void SetupMultiselectionHints() {
multiselectionHints = new[] { "Hold Shift to " + (BuilderPlug.Me.AdditiveSelect ? "disable" : "enable") + " additive selection",
"Hold Ctrl to enable subtractive selection",
"Hold Ctrl-Shift to intersect the new selection with already existing one",

View file

@ -668,7 +668,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
"Use " + gridIncKey + " and " + gridDecKey + " to change grid size",
"Press " + drawKey + " to start drawing lines",
};
}
//mxd
protected override void SetupMultiselectionHints() {
multiselectionHints = new[] { "Hold Shift to " + (BuilderPlug.Me.AdditiveSelect ? "disable" : "enable") + " additive selection",
"Hold Ctrl to enable subtractive selection",
"Hold Ctrl-Shift to intersect the new selection with already existing one",