Added, Draw Grid mode: "Lock slices to grid" now operates in 4 modes: "None", "Horizontal", "Vertical" and "Both". Can be helpful when drawing ladders and such.

Changed, all drawing modes: changeable drawing mode settings are now persistent.
Changed: "Dynamic grid size" mode is now disabled when changing grid size manually.
Documentation: "Command Line Parameters" topic contained a lot of incorrect information...
Updated ZDoom_DECORATE.cfg.
This commit is contained in:
MaxED 2016-03-04 13:41:55 +00:00 committed by spherallic
parent ea02a5404f
commit 338223e4b4
15 changed files with 348 additions and 188 deletions

View file

@ -368,7 +368,7 @@ keywords
A_BarrelDestroy = "A_BarrelDestroy"; A_BarrelDestroy = "A_BarrelDestroy";
//Miscellaneous functions not listed in the "Action functions" wiki article //Miscellaneous functions not listed in the "Action functions" wiki article
A_Bang4Cloud = "A_Bang4Cloud"; A_Bang4Cloud = "A_Bang4Cloud";
A_Blast = "A_Blast[(int flags = 0[, int strength = 255[, int radius = 255[, float speed = 20.0[, str blasteffect = \"BlastEffect\"[, sound blastsound = \"BlastRadius\"]]]]])]"; A_Blast = "A_Blast[(int flags = 0[, int strength = 255[, int radius = 255[, float speed = 20.0[, str blasteffect = \"BlastEffect\"[, str blastsound = \"BlastRadius\"]]]]])]\nA_Blast[(int flags = 0[, int strength = 255[, float radius = 255.0[, float speed = 20.0[, str blasteffect = \"BlastEffect\"[, str blastsound = \"BlastRadius\"]]]]])]";
A_BishopMissileWeave = "A_BishopMissileWeave"; A_BishopMissileWeave = "A_BishopMissileWeave";
A_DropWeaponPieces = "A_DropWeaponPieces(str actorclass1, str actorclass2, str actorclass3)"; A_DropWeaponPieces = "A_DropWeaponPieces(str actorclass1, str actorclass2, str actorclass3)";
A_Feathers = "A_Feathers"; A_Feathers = "A_Feathers";
@ -1080,6 +1080,7 @@ constants
CBF_SETTRACER; CBF_SETTRACER;
CBF_SETONPTR; CBF_SETONPTR;
CBF_DROPOFF; CBF_DROPOFF;
CBF_NOACTORS;
CHF_DONTMOVE; CHF_DONTMOVE;
CHF_FASTCHASE; CHF_FASTCHASE;
CHF_NIGHTMAREFAST; CHF_NIGHTMAREFAST;

View file

@ -1,55 +1,63 @@
Doom Builder 2 command-line arguments GZDoom Builder command-line arguments
========================================================================================== ==========================================================================================
Usage: Usage:
builder.exe [wadfile] [-map mapname] [-cfg configname] [-delaywindow] [-nopreferences] GZBuilder.exe [wadfile] [-map mapname] [-cfg configname] [-delaywindow] [-nopreferences]
[-strictpatches] [-resource wad|dir|pk3 [roottextures] [rootflats] [-strictpatches] [-portable] [-resource wad|dir|pk3 [roottextures]
[strictpatches] [notest] resourcename] [rootflats] [strictpatches] [notest] resourcename]
========================================================================================== ==========================================================================================
Parameters: Parameters:
- wadfile wadfile
This is a .WAD file to load immediately after Doom Builder has started up. Unless -map This is a .WAD file to load immediately after Doom Builder has started up. Unless -map
and -cfg are used, this will show the map-options dialog. and -cfg are used, this will show the map-options dialog.
- map -map "mapname"
Where 'mapname' is the name of the map (map header lump name) such as MAP01 or E1M1. When Where "mapname" is the name of the map (map header lump name) such as MAP01 or E1M1. When
specified, this will indicate the map to load from the specified wad file. Use in specified, this will indicate the map to load from the specified wad file. Use in
combination with -cfg to provide the required information to skip the map-options dialog. combination with -cfg to provide the required information to skip the map-options dialog.
- cfg -cfg "configname"
Where 'configname' is a game configuration filename, for example, "ZDoom_DoomHexen.cfg". -config "configname"
Where "configname" is a game configuration filename, for example, "ZDoom_DoomHexen.cfg".
Do NOT include the path, all game configurations must be in the Configurations subfolder. Do NOT include the path, all game configurations must be in the Configurations subfolder.
When used in combination with -map this will provide the required information to load a When used in combination with -map this will provide the required information to load a
map directly and skip the map-options dialog. map directly and skip the map-options dialog.
- delaywindow -delaywindow
This delays showing the main interface window until the automatic map loading from This delays showing the main interface window until the automatic map loading from
command line parameters is completed, and the program is not terminating yet. This is command line parameters is completed, and the program is not terminating yet. This is
usefull for plugins that can be used to perform batch processes where the showing of the usefull for plugins that can be used to perform batch processes where the showing of the
main interface window is not desired. If a plugin completes it's actions on map load and main interface window is not desired. If a plugin completes it's actions on map load and
terminates the application immediately, the main window will not be shown at all. terminates the application immediately, the main window will not be shown at all.
- nosettings -nosettings
When this parameter is specified, Doom Builder will not load your preferences or game When this parameter is specified, Doom Builder will not load your preferences or game
configuration settings and will use the default settings instead. You will not lose your configuration settings and will use the default settings instead. You will not lose your
original settings, but when this parameter is specified your settings will not be saved. original settings, but when this parameter is specified your settings will not be saved.
- strictpatches -strictpatches
Specify this parameter to enforce strictly loading texture patches from between P_START Specify this parameter to enforce strictly loading texture patches from between P_START
and P_END marker lumps only. This can solve lump name conflicts, but old WAD files do not and P_END marker lumps only. This can solve lump name conflicts, but old WAD files do not
always adhere to this rule. always adhere to this rule.
- resource -portable
The editor will be launched in portable mode. It will use the "GZBuilder.cfg" located in
the program directory instead of the one located in the
"%LocalAppData%\Doom Builder\GZBuilder.cfg" to load and save program settings. Log and
crash report files will be also created in the program directory.
-resource <resource type> [flags] "path\to\resource"
When -wadfile is specified, the -resource option can be used to add additional resources When -wadfile is specified, the -resource option can be used to add additional resources
that must be loaded along with the wad file. Note that these are added to the resources that must be loaded along with the wad file. Note that these are added to the resources
which are automatically loaded due to the selection of a game configuration. You can which are automatically loaded due to the selection of a game configuration. You can
repeat this option for any number of resources you wish to add. As always, the last repeat this option for any number of resources you wish to add. As always, the last
specified resource will override any data in earlier specified resource. This parameter specified resource will override any data in earlier specified resource.
has the following arguments:
This parameter has the following arguments:
wad|dir|pk3 Either 'wad', 'dir' or 'pk3' must be specified to indicate how this wad|dir|pk3 Either 'wad', 'dir' or 'pk3' must be specified to indicate how this
resource must be loaded. This is the same as selecting the tabs in resource must be loaded. This is the same as selecting the tabs in
@ -77,16 +85,18 @@ Examples:
This loads the file "Ubermegawad.wad" after Doom Builder is initialized and shows the This loads the file "Ubermegawad.wad" after Doom Builder is initialized and shows the
map-options dialog: map-options dialog:
builder.exe "C:\Games\Doom\My Maps\Ubermegawad.wad" GZBuilder.exe "C:\Games\Doom\My Maps\Ubermegawad.wad"
Same as the example above, but now without showing the map-options dialog and instead Same as the example above, but now without showing the map-options dialog and instead
immediately loads map MAP23 with the game configuration for Doom 2: immediately loads map MAP23 with the game configuration for Doom 2:
builder.exe "C:\Games\Doom\My Maps\Ubermegawad.wad" -map MAP23 -cfg "Doom2.cfg" GZBuilder.exe "C:\Games\Doom\My Maps\Ubermegawad.wad" -map MAP23 -cfg "Doom_Doom2Doom.cfg"
Same as the example above, but with added wad file resource and PK3 file resource: Same as the example above, but using one of GZDoom game configurations with added wad
file resource and PK3 file resources:
builder.exe "C:\Games\Doom\My Maps\Ubermegawad.wad" -map MAP23 -cfg "Doom2.cfg" GZBuilder.exe "C:\Games\Doom\My Maps\Ubermegawad.wad" -map MAP23 -cfg "GZDoom_DoomUDMF.cfg"
-resource pk3 notest "C:\GZDoom\gzdoom.pk3"
-resource wad strictpatches "C:\Games\Doom\gothtextures.wad" -resource wad strictpatches "C:\Games\Doom\gothtextures.wad"
-resource pk3 "C:\Games\Doom\hardmonsters.pk3" -resource pk3 "C:\Games\Doom\hardmonsters.pk3"

View file

@ -14,42 +14,67 @@
<h1>Command Line Parameters</h1> <h1>Command Line Parameters</h1>
</div> </div>
<div id="contents"> <div id="contents">
<p> All command line parameters are case-insensitive.<br /> <h2>Usage:</h2>
All command line parameters are case-insensitive.<br />
<br />
<b class="fat">GZBuilder.exe [wadfile] [-map mapname] [-cfg configname] [-delaywindow] [-nosettings]
[-strictpatches] [-portable] [-resource wad|dir|pk3 [roottextures] [rootflats]
[strictpatches] [notest] resourcename]</b>
<h2>Parameters:</h2>
<br />
<b class="fat">wadfile</b><br />
This is a .WAD file to load immediately after GZDoom Builder has started up. Unless <strong>-map</strong> and <strong>-cfg</strong> are used, this will show the map-options dialog.<br />
<p><b class="fat">-map &quot;mapname&quot;</b><br />
Where &quot;mapname&quot; is the name of the map (map header lump name) such as <strong>MAP01</strong> or <strong>E1M1</strong>.<br />
When specified, this will indicate the map to load from the specified wad file.<br />
Use in combination with <strong>-cfg</strong> to provide the required information to skip the map-options dialog.
<p><b class="fat">-delaywindow</b><br />
This delays showing the main interface window until the automatic map loading from command line parameters is completed, and the program is not terminating yet.<br />This is usefull for plugins that can be used to perform batch processes where the showing of the main interface window is not desired.<br />If a plugin completes it's actions on map load and terminates the application immediately, the main window will not be shown at all.
<p>
<b class="fat">-nosettings</b><br />
When this parameter is specified, GZDoom Builder will not load your preferences or game configuration settings and will use the default settings instead.<br />You will not lose your original settings, but when this parameter is specified your settings will not be saved.<br />
<br /> <br />
<b class="fat">-portable</b> - <span class="red">GZDB only.</span><br /> <b class="fat">-portable</b> - <span class="red">GZDB only.</span><br />
The editor will be launched in portable mode. It will use the &quot;GZBuilder.cfg&quot; located in the program directory instead of the one located in the &quot;%LocalAppData%\Doom Builder\GZBuilder.cfg&quot; to load and save program settings. Log and crash report files will be also created in the program directory.<br /> The editor will be launched in portable mode. It will use the &quot;GZBuilder.cfg&quot; located in the program directory instead of the one located in the &quot;%LocalAppData%\Doom Builder\GZBuilder.cfg&quot; to load and save program settings. Log and crash report files will be also created in the program directory.<br />
<br /> <h2>The following parameters are used only when both &quot;wadfile&quot; and &quot;-map&quot; parameters are present</h2>
<b class="fat">-nosettings</b><br />
The editor doesn't load or save program settings.<br />
<br />
<b class="fat">-delaywindow</b><br />
Delays showing of the main window.<br />
<br />
<b class="fat">-map &quot;path\to\mapfile.wad&quot;</b><br />
The editor will automatically load the specified map.<br />
<h2>The following parameters are used only in conjunction with the &quot;-map&quot; parameter</h2>
They replicate the settings, which can be set in the <a href="w_openmapoptions.html">Open Map Window</a>.<br /> They replicate the settings, which can be set in the <a href="w_openmapoptions.html">Open Map Window</a>.<br />
<br /> <br />
<b class="fat">-strictpatches</b><br /> <b class="fat">-strictpatches</b><br />
Enables strict patches rules.<br /> Specify this parameter to enforce strictly loading texture patches from between P_START
and P_END marker lumps only. This can solve lump name conflicts, but old WAD files do not
always adhere to this rule.<br />
<br /> <br />
<b class="fat">-cfg &quot;path\to\game configuration.cfg&quot;</b><br /> <b class="fat">-cfg &quot;game_configuration.cfg&quot;</b><br />
<b class="fat">-config &quot;path\to\game configuration.cfg&quot;</b><br /> <b class="fat">-config &quot;game_configuration.cfg&quot;</b><br />
The editor will use the specified game configuration file when loading the map.<br /> The editor will use the specified game configuration file when loading the map.<br />
Do not include the path, all game configurations must be in the &quot;Configurations&quot; subfolder.<br />
<br /> <br />
<b class="fat">-resource &lt;resource type&gt; [flags] &quot;path\to\resource&quot;</b><br /> <b class="fat">-resource &lt;resource type&gt; [flags] &quot;path\to\resource&quot;</b><br />
Adds a map resource.<br /> Adds a map resource. Note that these are added to the resources, which are automatically loaded according to selected game configuration.<br />
<strong>Resource type</strong> (required): &quot;wad&quot;, &quot;dir&quot; or &quot;pk3&quot;.<br /> <strong>Resource type</strong> (required): &quot;wad&quot;, &quot;dir&quot; or &quot;pk3&quot;.<br />
<strong>Flags</strong> (optional): <strong>Flags</strong> (optional):
<ul> <ul>
<li><strong>ROOTTEXTURES</strong> - load images in the root directory of the resource as textures.</li> <li><strong>ROOTTEXTURES</strong> - load images in the root directory of the resource as textures (directory/pk3 resources only).</li>
<li><strong>ROOTFLATS</strong> - load images in the root directory of the resource as flats.</li> <li><strong>ROOTFLATS</strong> - load images in the root directory of the resource as flats (directory/pk3 resources only).</li>
<li><strong>STRICTPATCHES</strong> - use strict rules for patches.</li> <li><strong>STRICTPATCHES</strong> - use strict rules for patches (wad resources only).</li>
<li><strong>NOTEST</strong> - exclude this resource from testing parameters.</li> <li><strong>NOTEST</strong> - exclude this resource from testing parameters.</li>
</ul> </ul>
<strong>Examples:</strong> <h2>Examples:</h2>
This loads the file "Ubermegawad.wad" after GZDoom Builder is initialized and shows the
map-options dialog:
<pre> <pre>
-resource pk3 notest "c:\GZDoom\gzdoom.pk3" GZBuilder.exe "C:\Games\Doom\My Maps\Ubermegawad.wad"
-resource WAD "c:\Doom\DOOM.WAD"</pre> </pre>
Same as the example above, but now without showing the map-options dialog and instead immediately loading map MAP23 with the Doom 2 game configuration:
<pre>
GZBuilder.exe "C:\Games\Doom\My Maps\Ubermegawad.wad" -map MAP23 -cfg "Doom_Doom2Doom.cfg"
</pre>
Same as the example above, but using one of GZDoom game configurations with added wad file resource and PK3 file resources:
<pre>
GZBuilder.exe "C:\Games\Doom\My Maps\Ubermegawad.wad" -map MAP23 -cfg "GZDoom_DoomUDMF.cfg"
-resource pk3 notest "C:\GZDoom\gzdoom.pk3"
-resource wad strictpatches "C:\Games\Doom\gothtextures.wad"
-resource pk3 "C:\Games\Doom\hardmonsters.pk3"
</pre>
</div> </div>
</body> </body>

View file

@ -246,7 +246,7 @@ namespace CodeImp.DoomBuilder.Editing
// This snaps to the nearest grid coordinate // This snaps to the nearest grid coordinate
public Vector2D SnappedToGrid(Vector2D v) public Vector2D SnappedToGrid(Vector2D v)
{ {
return GridSetup.SnappedToGrid(v, gridsizef, gridsizefinv); return SnappedToGrid(v, gridsizef, gridsizefinv);
} }
// This snaps to the nearest grid coordinate // This snaps to the nearest grid coordinate
@ -291,6 +291,9 @@ namespace CodeImp.DoomBuilder.Editing
// Not lower than 1 // Not lower than 1
if(gridsize >= 2) if(gridsize >= 2)
{ {
//mxd. Disable automatic grid resizing
General.MainWindow.DisableDynamicGridResize();
// Change grid // Change grid
SetGridSize(gridsize >> 1); SetGridSize(gridsize >> 1);
@ -307,6 +310,9 @@ namespace CodeImp.DoomBuilder.Editing
// Not higher than 1024 // Not higher than 1024
if(gridsize <= 512) if(gridsize <= 512)
{ {
//mxd. Disable automatic grid resizing
General.MainWindow.DisableDynamicGridResize();
// Change grid // Change grid
SetGridSize(gridsize << 1); SetGridSize(gridsize << 1);

View file

@ -140,8 +140,18 @@ namespace CodeImp.DoomBuilder.Windows
// Apply // Apply
private void apply_Click(object sender, EventArgs e) private void apply_Click(object sender, EventArgs e)
{ {
//mxd. Apply
int newgridsize = gridsize.GetResult(General.Map.Grid.GridSize);
if(newgridsize != General.Map.Grid.GridSize)
{
//Disable automatic grid resizing
General.MainWindow.DisableDynamicGridResize();
//Apply grid size
General.Map.Grid.SetGridSize(newgridsize);
}
// Apply // Apply
General.Map.Grid.SetGridSize(gridsize.GetResult(General.Map.Grid.GridSize));
General.Map.Grid.SetBackgroundView(backoffsetx.GetResult(General.Map.Grid.BackgroundX), General.Map.Grid.SetBackgroundView(backoffsetx.GetResult(General.Map.Grid.BackgroundX),
backoffsety.GetResult(General.Map.Grid.BackgroundY), backoffsety.GetResult(General.Map.Grid.BackgroundY),
backscalex.GetResult((int)(General.Map.Grid.BackgroundScaleX * 100.0f)) / 100.0f, backscalex.GetResult((int)(General.Map.Grid.BackgroundScaleX * 100.0f)) / 100.0f,

View file

@ -970,6 +970,9 @@ namespace CodeImp.DoomBuilder.Windows
// Get integral zoom level // Get integral zoom level
int size = int.Parse((sender as ToolStripMenuItem).Tag.ToString(), CultureInfo.InvariantCulture); int size = int.Parse((sender as ToolStripMenuItem).Tag.ToString(), CultureInfo.InvariantCulture);
//mxd. Disable automatic grid resizing
DisableDynamicGridResize();
// Change grid size // Change grid size
General.Map.Grid.SetGridSize(size); General.Map.Grid.SetGridSize(size);
@ -1540,6 +1543,17 @@ namespace CodeImp.DoomBuilder.Windows
} }
} }
//mxd
internal void DisableDynamicGridResize()
{
if(General.Settings.DynamicGridSize)
{
General.Settings.DynamicGridSize = false;
itemdynamicgridsize.Checked = false;
buttontoggledynamicgrid.Checked = false;
}
}
//mxd //mxd
private void TestEngine_Click(object sender, EventArgs e) private void TestEngine_Click(object sender, EventArgs e)
{ {

View file

@ -31,8 +31,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
private readonly HintLabel hintlabel; private readonly HintLabel hintlabel;
private Curve curve; private Curve curve;
private static int segmentlength = 32; private int segmentlength;
private const int MIN_SEGMENT_LENGTH = 1; private const int MIN_SEGMENT_LENGTH = 16;
private const int MAX_SEGMENT_LENGTH = 4096; //just some arbitrary number private const int MAX_SEGMENT_LENGTH = 4096; //just some arbitrary number
// Interface // Interface
@ -311,11 +311,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
protected override void SetupInterface() protected override void SetupInterface()
{ {
// Load stored settings
segmentlength = General.Clamp(General.Settings.ReadPluginSetting("drawcurvemode.segmentlength", 32), MIN_SEGMENT_LENGTH, MAX_SEGMENT_LENGTH);
// Add options docker // Add options docker
panel = new DrawCurveOptionsPanel(MIN_SEGMENT_LENGTH, MAX_SEGMENT_LENGTH); panel = new DrawCurveOptionsPanel(MIN_SEGMENT_LENGTH, MAX_SEGMENT_LENGTH);
panel.SegmentLength = segmentlength;
panel.OnValueChanged += OptionsPanelOnValueChanged; panel.OnValueChanged += OptionsPanelOnValueChanged;
panel.OnContinuousDrawingChanged += OnContinuousDrawingChanged; panel.OnContinuousDrawingChanged += OnContinuousDrawingChanged;
panel.ContinuousDrawing = General.Settings.ReadPluginSetting("drawcurvemode_continuousdrawing", false);
// Needs to be set after adding the OnContinuousDrawingChanged event...
panel.ContinuousDrawing = General.Settings.ReadPluginSetting("drawcurvemode.continuousdrawing", false);
} }
protected override void AddInterface() protected override void AddInterface()
@ -325,7 +331,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
protected override void RemoveInterface() protected override void RemoveInterface()
{ {
General.Settings.WritePluginSetting("drawcurvemode_continuousdrawing", panel.ContinuousDrawing); // Store settings
General.Settings.WritePluginSetting("drawcurvemode.segmentlength", segmentlength);
General.Settings.WritePluginSetting("drawcurvemode.continuousdrawing", panel.ContinuousDrawing);
// Remove the buttons
panel.Unregister(); panel.Unregister();
} }

View file

@ -44,27 +44,39 @@ namespace CodeImp.DoomBuilder.BuilderModes
maxsubdivisions = 512; maxsubdivisions = 512;
minsubdivisions = 6; minsubdivisions = 6;
// Load stored settings
subdivisions = General.Clamp(General.Settings.ReadPluginSetting("drawellipsemode.subdivisions", 8), minsubdivisions, maxsubdivisions);
bevelwidth = General.Settings.ReadPluginSetting("drawellipsemode.bevelwidth", 0);
currentbevelwidth = bevelwidth;
//Add options docker //Add options docker
panel = new DrawEllipseOptionsPanel(); panel = new DrawEllipseOptionsPanel();
panel.MaxSubdivisions = maxsubdivisions; panel.MaxSubdivisions = maxsubdivisions;
panel.MinSubdivisions = minsubdivisions; panel.MinSubdivisions = minsubdivisions;
panel.MinSpikiness = (int)General.Map.FormatInterface.MinCoordinate; panel.MinSpikiness = (int)General.Map.FormatInterface.MinCoordinate;
panel.MaxSpikiness = (int)General.Map.FormatInterface.MaxCoordinate; panel.MaxSpikiness = (int)General.Map.FormatInterface.MaxCoordinate;
panel.Spikiness = bevelwidth;
panel.Subdivisions = subdivisions;
panel.OnValueChanged += OptionsPanelOnValueChanged; panel.OnValueChanged += OptionsPanelOnValueChanged;
panel.OnContinuousDrawingChanged += OnContinuousDrawingChanged; panel.OnContinuousDrawingChanged += OnContinuousDrawingChanged;
panel.ContinuousDrawing = General.Settings.ReadPluginSetting("drawellipsemode_continuousdrawing", false);
// Needs to be set after adding the OnContinuousDrawingChanged event...
panel.ContinuousDrawing = General.Settings.ReadPluginSetting("drawellipsemode.continuousdrawing", false);
} }
override protected void AddInterface() override protected void AddInterface()
{ {
panel.Register(); panel.Register();
bevelwidth = panel.Spikiness;
subdivisions = panel.Subdivisions;
} }
override protected void RemoveInterface() override protected void RemoveInterface()
{ {
General.Settings.WritePluginSetting("drawellipsemode_continuousdrawing", panel.ContinuousDrawing); // Store settings
General.Settings.WritePluginSetting("drawellipsemode.subdivisions", subdivisions);
General.Settings.WritePluginSetting("drawellipsemode.bevelwidth", bevelwidth);
General.Settings.WritePluginSetting("drawellipsemode.continuousdrawing", panel.ContinuousDrawing);
// Remove the buttons
panel.Unregister(); panel.Unregister();
} }

View file

@ -18,14 +18,14 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
using CodeImp.DoomBuilder.Windows; using CodeImp.DoomBuilder.Actions;
using CodeImp.DoomBuilder.Editing;
using CodeImp.DoomBuilder.Geometry;
using CodeImp.DoomBuilder.Map; using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Rendering; using CodeImp.DoomBuilder.Rendering;
using CodeImp.DoomBuilder.Geometry; using CodeImp.DoomBuilder.Windows;
using System.Drawing;
using CodeImp.DoomBuilder.Editing;
using CodeImp.DoomBuilder.Actions;
#endregion #endregion
@ -460,7 +460,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
//Add options docker //Add options docker
panel = new DrawLineOptionsPanel(); panel = new DrawLineOptionsPanel();
panel.OnContinuousDrawingChanged += OnContinuousDrawingChanged; panel.OnContinuousDrawingChanged += OnContinuousDrawingChanged;
panel.ContinuousDrawing = General.Settings.ReadPluginSetting("drawlinesmode_continuousdrawing", false);
// Needs to be set after adding the OnContinuousDrawingChanged event...
panel.ContinuousDrawing = General.Settings.ReadPluginSetting("drawlinesmode.continuousdrawing", false);
} }
protected virtual void AddInterface() protected virtual void AddInterface()
@ -470,7 +472,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
protected virtual void RemoveInterface() protected virtual void RemoveInterface()
{ {
General.Settings.WritePluginSetting("drawlinesmode_continuousdrawing", panel.ContinuousDrawing); General.Settings.WritePluginSetting("drawlinesmode.continuousdrawing", panel.ContinuousDrawing);
panel.Unregister(); panel.Unregister();
} }

View file

@ -27,15 +27,29 @@ namespace CodeImp.DoomBuilder.BuilderModes
public class DrawGridMode : DrawGeometryMode public class DrawGridMode : DrawGeometryMode
{ {
#region ================== Enums
public enum GridLockMode
{
NONE,
HORIZONTAL,
VERTICAL,
BOTH,
}
#endregion
#region ================== Variables #region ================== Variables
private static int horizontalSlices = 3; // Settings
private static int verticalSlices = 3; private int horizontalslices;
private static bool triangulate; private int verticalslices;
private static bool gridlock; private bool triangulate;
private static InterpolationTools.Mode horizontalinterpolation = InterpolationTools.Mode.LINEAR; private GridLockMode gridlockmode;
private static InterpolationTools.Mode verticalinterpolation = InterpolationTools.Mode.LINEAR; private InterpolationTools.Mode horizontalinterpolation;
private InterpolationTools.Mode verticalinterpolation;
// Drawing
private readonly List<DrawnVertex[]> gridpoints; private readonly List<DrawnVertex[]> gridpoints;
private HintLabel hintlabel; private HintLabel hintlabel;
@ -46,7 +60,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
private Vector2D start; private Vector2D start;
private Vector2D end; private Vector2D end;
//interface // Interface
private DrawGridOptionsPanel panel; private DrawGridOptionsPanel panel;
private Docker docker; private Docker docker;
@ -144,17 +158,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
private void OptionsPanelOnValueChanged(object sender, EventArgs eventArgs) private void OptionsPanelOnValueChanged(object sender, EventArgs eventArgs)
{ {
triangulate = panel.Triangulate; triangulate = panel.Triangulate;
horizontalSlices = panel.HorizontalSlices + 1; horizontalslices = panel.HorizontalSlices + 1;
verticalSlices = panel.VerticalSlices + 1; verticalslices = panel.VerticalSlices + 1;
horizontalinterpolation = panel.HorizontalInterpolationMode; horizontalinterpolation = panel.HorizontalInterpolationMode;
verticalinterpolation = panel.VerticalInterpolationMode; verticalinterpolation = panel.VerticalInterpolationMode;
Update(); Update();
} }
private void OptionsPanelOnOnGridLockChanged(object sender, EventArgs eventArgs) private void OptionsPanelOnGridLockChanged(object sender, EventArgs eventArgs)
{ {
gridlock = panel.LockToGrid; gridlockmode = panel.GridLockMode;
General.Hints.ShowHints(this.GetType(), (gridlock ? "gridlockhelp" : "general")); General.Hints.ShowHints(this.GetType(), ((gridlockmode != GridLockMode.NONE) ? "gridlockhelp" : "general"));
Update(); Update();
} }
@ -174,8 +188,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
// We WANT snaptogrid and DON'T WANT snaptonearest when lock to grid is enabled // We WANT snaptogrid and DON'T WANT snaptonearest when lock to grid is enabled
snaptocardinaldirection = General.Interface.ShiftState && General.Interface.AltState; //mxd snaptocardinaldirection = General.Interface.ShiftState && General.Interface.AltState; //mxd
snaptogrid = (snaptocardinaldirection || gridlock || (General.Interface.ShiftState ^ General.Interface.SnapToGrid)); snaptogrid = (snaptocardinaldirection || gridlockmode != GridLockMode.NONE || (General.Interface.ShiftState ^ General.Interface.SnapToGrid));
snaptonearest = (!gridlock && (General.Interface.CtrlState ^ General.Interface.AutoMerge)); snaptonearest = (gridlockmode == GridLockMode.NONE && (General.Interface.CtrlState ^ General.Interface.AutoMerge));
DrawnVertex curp; DrawnVertex curp;
if(points.Count == 1) if(points.Count == 1)
@ -225,7 +239,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
//render hint //render hint
if(horizontalSlices > 1 || verticalSlices > 1) if(horizontalslices > 1 || verticalslices > 1)
{ {
hintlabel.Text = "H: " + (slicesH - 1) + "; V: " + (slicesV - 1); hintlabel.Text = "H: " + (slicesH - 1) + "; V: " + (slicesV - 1);
if(width > hintlabel.Text.Length * vsize && height > 16 * vsize) if(width > hintlabel.Text.Length * vsize && height > 16 * vsize)
@ -256,10 +270,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
pos.y > General.Map.Config.TopBoundary || pos.y < General.Map.Config.BottomBoundary) pos.y > General.Map.Config.TopBoundary || pos.y < General.Map.Config.BottomBoundary)
return false; return false;
DrawnVertex newpoint = new DrawnVertex(); DrawnVertex newpoint = new DrawnVertex { pos = pos, stitch = true, stitchline = stitchline };
newpoint.pos = pos;
newpoint.stitch = true;
newpoint.stitchline = stitchline;
points.Add(newpoint); points.Add(newpoint);
if(points.Count == 1) if(points.Count == 1)
@ -290,10 +301,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
DrawnVertex[] verts = new DrawnVertex[shape.Length]; DrawnVertex[] verts = new DrawnVertex[shape.Length];
for(int i = 0; i < shape.Length; i++) for(int i = 0; i < shape.Length; i++)
{ {
newpoint = new DrawnVertex(); newpoint = new DrawnVertex { pos = shape[i], stitch = true, stitchline = stitchline };
newpoint.pos = shape[i];
newpoint.stitch = true;
newpoint.stitchline = stitchline;
verts[i] = newpoint; verts[i] = newpoint;
} }
@ -307,22 +315,34 @@ namespace CodeImp.DoomBuilder.BuilderModes
private List<Vector2D[]> GetShapes(Vector2D s, Vector2D e) private List<Vector2D[]> GetShapes(Vector2D s, Vector2D e)
{ {
//no shape // No shape
if(s == e) return new List<Vector2D[]>(); if(s == e) return new List<Vector2D[]>();
//setup slices // Setup slices
if(gridlock) switch(gridlockmode)
{ {
case GridLockMode.NONE:
slicesH = horizontalslices;
slicesV = verticalslices;
break;
case GridLockMode.HORIZONTAL:
slicesH = width / General.Map.Grid.GridSize;
slicesV = verticalslices;
break;
case GridLockMode.VERTICAL:
slicesH = horizontalslices;
slicesV = height / General.Map.Grid.GridSize;
break;
case GridLockMode.BOTH:
slicesH = width / General.Map.Grid.GridSize; slicesH = width / General.Map.Grid.GridSize;
slicesV = height / General.Map.Grid.GridSize; slicesV = height / General.Map.Grid.GridSize;
} break;
else
{
slicesH = horizontalSlices;
slicesV = verticalSlices;
} }
//create a segmented line // Create a segmented line
List<Vector2D[]> shapes; List<Vector2D[]> shapes;
if(width == 0 || height == 0) if(width == 0 || height == 0)
{ {
@ -348,19 +368,19 @@ namespace CodeImp.DoomBuilder.BuilderModes
return shapes; return shapes;
} }
//create a line // Create a line
return new List<Vector2D[]> {new[] {s, e}}; return new List<Vector2D[]> {new[] {s, e}};
} }
//create shape // Create shape
List<Vector2D> rect = new List<Vector2D> { s, new Vector2D((int)s.x, (int)e.y), e, new Vector2D((int)e.x, (int)s.y), s }; List<Vector2D> rect = new List<Vector2D> { s, new Vector2D((int)s.x, (int)e.y), e, new Vector2D((int)e.x, (int)s.y), s };
if(!gridlock && slicesH == 1 && slicesV == 1) if(slicesH == 1 && slicesV == 1)
{ {
if(triangulate) rect.AddRange(new[] { s, e }); if(triangulate) rect.AddRange(new[] { s, e });
return new List<Vector2D[]> { rect.ToArray() }; return new List<Vector2D[]> { rect.ToArray() };
} }
//create blocks // Create blocks
shapes = new List<Vector2D[]> { rect.ToArray() }; shapes = new List<Vector2D[]> { rect.ToArray() };
RectangleF[,] blocks = new RectangleF[slicesH, slicesV]; RectangleF[,] blocks = new RectangleF[slicesH, slicesV];
for(int w = 0; w < slicesH; w++) for(int w = 0; w < slicesH; w++)
@ -375,7 +395,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
} }
//add subdivisions // Add subdivisions
if(slicesH > 1) if(slicesH > 1)
{ {
for(int w = 1; w < slicesH; w++) for(int w = 1; w < slicesH; w++)
@ -393,7 +413,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
} }
//triangulate? // Triangulate?
if(triangulate) if(triangulate)
{ {
bool startflip = ((int)Math.Round(((s.x + e.y) / General.Map.Grid.GridSize) % 2) == 0); bool startflip = ((int)Math.Round(((s.x + e.y) / General.Map.Grid.GridSize) % 2) == 0);
@ -419,7 +439,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
return shapes; return shapes;
} }
//update bottom-left and top-right points, which define drawing shape // Update bottom-left and top-right points, which define drawing shape
private void UpdateReferencePoints(DrawnVertex p1, DrawnVertex p2) private void UpdateReferencePoints(DrawnVertex p1, DrawnVertex p2)
{ {
if(!p1.pos.IsFinite() || !p2.pos.IsFinite()) return; if(!p1.pos.IsFinite() || !p2.pos.IsFinite()) return;
@ -456,22 +476,31 @@ namespace CodeImp.DoomBuilder.BuilderModes
protected override void SetupInterface() protected override void SetupInterface()
{ {
// Load stored settings
triangulate = General.Settings.ReadPluginSetting("drawgridmode.triangulate", false);
gridlockmode = (GridLockMode)General.Settings.ReadPluginSetting("drawgridmode.gridlockmode", 0);
horizontalslices = Math.Max(General.Settings.ReadPluginSetting("drawgridmode.horizontalslices", 3), 3);
verticalslices = Math.Max(General.Settings.ReadPluginSetting("drawgridmode.verticalslices", 3), 3);
horizontalinterpolation = (InterpolationTools.Mode)General.Settings.ReadPluginSetting("drawgridmode.horizontalinterpolation", 0);
verticalinterpolation = (InterpolationTools.Mode)General.Settings.ReadPluginSetting("drawgridmode.verticalinterpolation", 0);
// Create and setup settings panel // Create and setup settings panel
panel = new DrawGridOptionsPanel(); panel = new DrawGridOptionsPanel();
panel.MaxHorizontalSlices = (int)General.Map.FormatInterface.MaxCoordinate; panel.MaxHorizontalSlices = (int)General.Map.FormatInterface.MaxCoordinate;
panel.MaxVerticalSlices = (int)General.Map.FormatInterface.MaxCoordinate; panel.MaxVerticalSlices = (int)General.Map.FormatInterface.MaxCoordinate;
panel.Triangulate = triangulate; panel.Triangulate = triangulate;
panel.LockToGrid = gridlock; panel.GridLockMode = gridlockmode;
panel.HorizontalSlices = horizontalSlices - 1; panel.HorizontalSlices = horizontalslices - 1;
panel.VerticalSlices = verticalSlices - 1; panel.VerticalSlices = verticalslices - 1;
panel.HorizontalInterpolationMode = horizontalinterpolation; panel.HorizontalInterpolationMode = horizontalinterpolation;
panel.VerticalInterpolationMode = verticalinterpolation; panel.VerticalInterpolationMode = verticalinterpolation;
panel.OnValueChanged += OptionsPanelOnValueChanged; panel.OnValueChanged += OptionsPanelOnValueChanged;
panel.OnGridLockChanged += OptionsPanelOnOnGridLockChanged; panel.OnGridLockModeChanged += OptionsPanelOnGridLockChanged;
panel.OnContinuousDrawingChanged += OnContinuousDrawingChanged; panel.OnContinuousDrawingChanged += OnContinuousDrawingChanged;
panel.ContinuousDrawing = General.Settings.ReadPluginSetting("drawgridmode_continuousdrawing", false); // Needs to be set after adding the OnContinuousDrawingChanged event...
panel.ContinuousDrawing = General.Settings.ReadPluginSetting("drawgridmode.continuousdrawing", false);
} }
protected override void AddInterface() protected override void AddInterface()
@ -484,7 +513,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
protected override void RemoveInterface() protected override void RemoveInterface()
{ {
General.Settings.WritePluginSetting("drawgridmode_continuousdrawing", panel.ContinuousDrawing); // Store settings
General.Settings.WritePluginSetting("drawgridmode.triangulate", triangulate);
General.Settings.WritePluginSetting("drawgridmode.gridlockmode", (int)gridlockmode);
General.Settings.WritePluginSetting("drawgridmode.horizontalslices", horizontalslices);
General.Settings.WritePluginSetting("drawgridmode.verticalslices", verticalslices);
General.Settings.WritePluginSetting("drawgridmode.horizontalinterpolation", (int)horizontalinterpolation);
General.Settings.WritePluginSetting("drawgridmode.verticalinterpolation", (int)verticalinterpolation);
General.Settings.WritePluginSetting("drawgridmode.continuousdrawing", panel.ContinuousDrawing);
// Remove docker // Remove docker
General.Interface.RemoveDocker(docker); General.Interface.RemoveDocker(docker);
@ -499,10 +535,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
[BeginAction("increasebevel")] [BeginAction("increasebevel")]
protected void IncreaseBevel() protected void IncreaseBevel()
{ {
if(!gridlock && (points.Count < 2 || horizontalSlices < width - 2) && horizontalSlices - 1 < panel.MaxHorizontalSlices) if((gridlockmode == GridLockMode.NONE || gridlockmode == GridLockMode.VERTICAL)
&& (points.Count < 2 || horizontalslices < width - 2)
&& horizontalslices - 1 < panel.MaxHorizontalSlices)
{ {
horizontalSlices++; horizontalslices++;
panel.HorizontalSlices = horizontalSlices - 1; panel.HorizontalSlices = horizontalslices - 1;
Update(); Update();
} }
} }
@ -510,10 +548,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
[BeginAction("decreasebevel")] [BeginAction("decreasebevel")]
protected void DecreaseBevel() protected void DecreaseBevel()
{ {
if(!gridlock && horizontalSlices > 1) if((gridlockmode == GridLockMode.NONE || gridlockmode == GridLockMode.VERTICAL) && horizontalslices > 1)
{ {
horizontalSlices--; horizontalslices--;
panel.HorizontalSlices = horizontalSlices - 1; panel.HorizontalSlices = horizontalslices - 1;
Update(); Update();
} }
} }
@ -521,10 +559,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
[BeginAction("increasesubdivlevel")] [BeginAction("increasesubdivlevel")]
protected void IncreaseSubdivLevel() protected void IncreaseSubdivLevel()
{ {
if(!gridlock && (points.Count < 2 || verticalSlices < height - 2) && verticalSlices - 1 < panel.MaxVerticalSlices) if((gridlockmode == GridLockMode.NONE || gridlockmode == GridLockMode.HORIZONTAL)
&& (points.Count < 2 || verticalslices < height - 2)
&& verticalslices - 1 < panel.MaxVerticalSlices)
{ {
verticalSlices++; verticalslices++;
panel.VerticalSlices = verticalSlices - 1; panel.VerticalSlices = verticalslices - 1;
Update(); Update();
} }
} }
@ -532,10 +572,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
[BeginAction("decreasesubdivlevel")] [BeginAction("decreasesubdivlevel")]
protected void DecreaseSubdivLevel() protected void DecreaseSubdivLevel()
{ {
if(!gridlock && verticalSlices > 1) if((gridlockmode == GridLockMode.NONE || gridlockmode == GridLockMode.HORIZONTAL) && verticalslices > 1)
{ {
verticalSlices--; verticalslices--;
panel.VerticalSlices = verticalSlices - 1; panel.VerticalSlices = verticalslices - 1;
Update(); Update();
} }
} }

View file

@ -79,27 +79,39 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
maxsubdivisions = 16; maxsubdivisions = 16;
// Load stored settings
subdivisions = General.Clamp(General.Settings.ReadPluginSetting("drawrectanglemode.subdivisions", 0), minsubdivisions, maxsubdivisions);
bevelwidth = General.Settings.ReadPluginSetting("drawrectanglemode.bevelwidth", 0);
currentbevelwidth = bevelwidth;
//Add options docker //Add options docker
panel = new DrawRectangleOptionsPanel(); panel = new DrawRectangleOptionsPanel();
panel.MaxSubdivisions = maxsubdivisions; panel.MaxSubdivisions = maxsubdivisions;
panel.MinSubdivisions = minsubdivisions; panel.MinSubdivisions = minsubdivisions;
panel.MaxBevelWidth = (int)General.Map.FormatInterface.MaxCoordinate; panel.MaxBevelWidth = (int)General.Map.FormatInterface.MaxCoordinate;
panel.MinBevelWidth = (int)General.Map.FormatInterface.MinCoordinate; panel.MinBevelWidth = (int)General.Map.FormatInterface.MinCoordinate;
panel.BevelWidth = bevelwidth;
panel.Subdivisions = subdivisions;
panel.OnValueChanged += OptionsPanelOnValueChanged; panel.OnValueChanged += OptionsPanelOnValueChanged;
panel.OnContinuousDrawingChanged += OnContinuousDrawingChanged; panel.OnContinuousDrawingChanged += OnContinuousDrawingChanged;
panel.ContinuousDrawing = General.Settings.ReadPluginSetting("drawrectanglemode_continuousdrawing", false);
// Needs to be set after adding the OnContinuousDrawingChanged event...
panel.ContinuousDrawing = General.Settings.ReadPluginSetting("drawrectanglemode.continuousdrawing", false);
} }
protected override void AddInterface() protected override void AddInterface()
{ {
panel.Register(); panel.Register();
bevelwidth = panel.BevelWidth;
subdivisions = panel.Subdivisions;
} }
protected override void RemoveInterface() protected override void RemoveInterface()
{ {
General.Settings.WritePluginSetting("drawrectanglemode_continuousdrawing", panel.ContinuousDrawing); // Store settings
General.Settings.WritePluginSetting("drawrectanglemode.subdivisions", subdivisions);
General.Settings.WritePluginSetting("drawrectanglemode.bevelwidth", bevelwidth);
General.Settings.WritePluginSetting("drawrectanglemode.continuousdrawing", panel.ContinuousDrawing);
// Remove the buttons
panel.Unregister(); panel.Unregister();
} }

View file

@ -9,9 +9,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
public event EventHandler OnContinuousDrawingChanged; public event EventHandler OnContinuousDrawingChanged;
private bool blockevents; private bool blockevents;
private static int aquityvalue;
private static int subdivsvalue = 8;
public int Spikiness { get { return (int)spikiness.Value; } set { blockevents = true; spikiness.Value = value; blockevents = false; } } public int Spikiness { get { return (int)spikiness.Value; } set { blockevents = true; spikiness.Value = value; blockevents = false; } }
public int Subdivisions { get { return (int)subdivs.Value; } set { blockevents = true; subdivs.Value = value; blockevents = false; } } public int Subdivisions { get { return (int)subdivs.Value; } set { blockevents = true; subdivs.Value = value; blockevents = false; } }
public int MaxSubdivisions { get { return (int)subdivs.Maximum; } set { subdivs.Maximum = value; } } public int MaxSubdivisions { get { return (int)subdivs.Maximum; } set { subdivs.Maximum = value; } }
@ -27,8 +24,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
public void Register() public void Register()
{ {
spikiness.Value = aquityvalue;
subdivs.Value = subdivsvalue;
spikiness.ValueChanged += ValueChanged; spikiness.ValueChanged += ValueChanged;
subdivs.ValueChanged += ValueChanged; subdivs.ValueChanged += ValueChanged;
@ -54,8 +49,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
private void ValueChanged(object sender, EventArgs e) private void ValueChanged(object sender, EventArgs e)
{ {
aquityvalue = (int)spikiness.Value;
subdivsvalue = (int)subdivs.Value;
if(!blockevents && OnValueChanged != null) OnValueChanged(this, EventArgs.Empty); if(!blockevents && OnValueChanged != null) OnValueChanged(this, EventArgs.Empty);
} }

View file

@ -29,8 +29,9 @@
private void InitializeComponent() private void InitializeComponent()
{ {
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.gridlockmode = new System.Windows.Forms.ComboBox();
this.label5 = new System.Windows.Forms.Label();
this.triangulate = new System.Windows.Forms.CheckBox(); this.triangulate = new System.Windows.Forms.CheckBox();
this.gridlock = new System.Windows.Forms.CheckBox();
this.reset = new System.Windows.Forms.Button(); this.reset = new System.Windows.Forms.Button();
this.slicesV = new System.Windows.Forms.NumericUpDown(); this.slicesV = new System.Windows.Forms.NumericUpDown();
this.slicesH = new System.Windows.Forms.NumericUpDown(); this.slicesH = new System.Windows.Forms.NumericUpDown();
@ -54,8 +55,9 @@
// //
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.gridlockmode);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.triangulate); this.groupBox1.Controls.Add(this.triangulate);
this.groupBox1.Controls.Add(this.gridlock);
this.groupBox1.Controls.Add(this.reset); this.groupBox1.Controls.Add(this.reset);
this.groupBox1.Controls.Add(this.slicesV); this.groupBox1.Controls.Add(this.slicesV);
this.groupBox1.Controls.Add(this.slicesH); this.groupBox1.Controls.Add(this.slicesH);
@ -68,6 +70,32 @@
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = " Number of slices: "; this.groupBox1.Text = " Number of slices: ";
// //
// gridlockmode
//
this.gridlockmode.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.gridlockmode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.gridlockmode.FormattingEnabled = true;
this.gridlockmode.Items.AddRange(new object[] {
"None",
"Horizontal",
"Vertical",
"Both"});
this.gridlockmode.Location = new System.Drawing.Point(118, 77);
this.gridlockmode.Name = "gridlockmode";
this.gridlockmode.Size = new System.Drawing.Size(76, 21);
this.gridlockmode.TabIndex = 16;
this.gridlockmode.SelectedIndexChanged += new System.EventHandler(this.gridlockmode_SelectedIndexChanged);
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(17, 80);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(95, 13);
this.label5.TabIndex = 15;
this.label5.Text = "Lock slices to grid:";
//
// triangulate // triangulate
// //
this.triangulate.AutoSize = true; this.triangulate.AutoSize = true;
@ -79,17 +107,6 @@
this.triangulate.UseVisualStyleBackColor = true; this.triangulate.UseVisualStyleBackColor = true;
this.triangulate.CheckedChanged += new System.EventHandler(this.ValueChanged); this.triangulate.CheckedChanged += new System.EventHandler(this.ValueChanged);
// //
// gridlock
//
this.gridlock.AutoSize = true;
this.gridlock.Location = new System.Drawing.Point(20, 80);
this.gridlock.Name = "gridlock";
this.gridlock.Size = new System.Drawing.Size(111, 17);
this.gridlock.TabIndex = 13;
this.gridlock.Text = "Lock slices to grid";
this.gridlock.UseVisualStyleBackColor = true;
this.gridlock.CheckedChanged += new System.EventHandler(this.gridlock_CheckedChanged);
//
// reset // reset
// //
this.reset.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.Reset; this.reset.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.Reset;
@ -224,7 +241,7 @@
this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox1);
this.Name = "DrawGridOptionsPanel"; this.Name = "DrawGridOptionsPanel";
this.Size = new System.Drawing.Size(206, 299); this.Size = new System.Drawing.Size(206, 426);
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout(); this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.slicesV)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.slicesV)).EndInit();
@ -241,7 +258,6 @@
private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.CheckBox triangulate; private System.Windows.Forms.CheckBox triangulate;
private System.Windows.Forms.CheckBox gridlock;
private System.Windows.Forms.Button reset; private System.Windows.Forms.Button reset;
private System.Windows.Forms.NumericUpDown slicesV; private System.Windows.Forms.NumericUpDown slicesV;
private System.Windows.Forms.NumericUpDown slicesH; private System.Windows.Forms.NumericUpDown slicesH;
@ -254,5 +270,7 @@
private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label4;
private System.Windows.Forms.GroupBox groupBox3; private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.CheckBox continuousdrawing; private System.Windows.Forms.CheckBox continuousdrawing;
private System.Windows.Forms.ComboBox gridlockmode;
private System.Windows.Forms.Label label5;
} }
} }

View file

@ -1,31 +1,42 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using CodeImp.DoomBuilder.Geometry; using InterpolationMode = CodeImp.DoomBuilder.Geometry.InterpolationTools.Mode;
using GridLockMode = CodeImp.DoomBuilder.BuilderModes.DrawGridMode.GridLockMode;
namespace CodeImp.DoomBuilder.BuilderModes namespace CodeImp.DoomBuilder.BuilderModes
{ {
internal partial class DrawGridOptionsPanel : UserControl internal partial class DrawGridOptionsPanel : UserControl
{ {
public event EventHandler OnValueChanged; public event EventHandler OnValueChanged;
public event EventHandler OnGridLockChanged; public event EventHandler OnGridLockModeChanged;
public event EventHandler OnContinuousDrawingChanged; public event EventHandler OnContinuousDrawingChanged;
private bool blockevents; private bool blockevents;
public bool Triangulate { get { return triangulate.Checked; } set { blockevents = true; triangulate.Checked = value; blockevents = false; } } public bool Triangulate { get { return triangulate.Checked; } set { blockevents = true; triangulate.Checked = value; blockevents = false; } }
public bool LockToGrid { get { return gridlock.Checked; } set { blockevents = true; gridlock.Checked = value; blockevents = false; } } public GridLockMode GridLockMode { get { return (GridLockMode)gridlockmode.SelectedIndex; } set { blockevents = true; gridlockmode.SelectedIndex = (int)value; blockevents = false; } }
public int HorizontalSlices { get { return (int)slicesH.Value; } set { blockevents = true; slicesH.Value = value; blockevents = false; } } public int HorizontalSlices { get { return (int)slicesH.Value; } set { blockevents = true; slicesH.Value = value; blockevents = false; } }
public int MaxHorizontalSlices { get { return (int)slicesH.Maximum; } set { slicesH.Maximum = value; } } public int MaxHorizontalSlices { get { return (int)slicesH.Maximum; } set { slicesH.Maximum = value; } }
public int VerticalSlices { get { return (int)slicesV.Value; } set { blockevents = true; slicesV.Value = value; blockevents = false; } } public int VerticalSlices { get { return (int)slicesV.Value; } set { blockevents = true; slicesV.Value = value; blockevents = false; } }
public int MaxVerticalSlices { get { return (int)slicesV.Maximum; } set { slicesV.Maximum = value; } } public int MaxVerticalSlices { get { return (int)slicesV.Maximum; } set { slicesV.Maximum = value; } }
public bool ContinuousDrawing { get { return continuousdrawing.Checked; } set { continuousdrawing.Checked = value; } } public bool ContinuousDrawing { get { return continuousdrawing.Checked; } set { continuousdrawing.Checked = value; } }
public InterpolationTools.Mode HorizontalInterpolationMode public InterpolationMode HorizontalInterpolationMode
{ {
get { return gridlock.Checked ? InterpolationTools.Mode.LINEAR : (InterpolationTools.Mode)interphmode.SelectedIndex; } get
{
GridLockMode mode = (GridLockMode)gridlockmode.SelectedIndex;
return (mode == GridLockMode.BOTH || mode == GridLockMode.HORIZONTAL)
? InterpolationMode.LINEAR : (InterpolationMode)interphmode.SelectedIndex;
}
set { interphmode.SelectedIndex = (int)value; } set { interphmode.SelectedIndex = (int)value; }
} }
public InterpolationTools.Mode VerticalInterpolationMode public InterpolationMode VerticalInterpolationMode
{ {
get { return gridlock.Checked ? InterpolationTools.Mode.LINEAR : (InterpolationTools.Mode)interpvmode.SelectedIndex; } get
{
GridLockMode mode = (GridLockMode)gridlockmode.SelectedIndex;
return (mode == GridLockMode.BOTH || mode == GridLockMode.VERTICAL)
? InterpolationMode.LINEAR : (InterpolationMode)interpvmode.SelectedIndex;
}
set { interpvmode.SelectedIndex = (int)value; } set { interpvmode.SelectedIndex = (int)value; }
} }
@ -45,15 +56,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(!blockevents && OnValueChanged != null) OnValueChanged(this, EventArgs.Empty); if(!blockevents && OnValueChanged != null) OnValueChanged(this, EventArgs.Empty);
} }
private void gridlock_CheckedChanged(object sender, EventArgs e) private void gridlockmode_SelectedIndexChanged(object sender, EventArgs e)
{ {
slicesH.Enabled = !gridlock.Checked; GridLockMode mode = (GridLockMode)gridlockmode.SelectedIndex;
slicesV.Enabled = !gridlock.Checked; slicesH.Enabled = (mode == GridLockMode.NONE || mode == GridLockMode.VERTICAL);
interpvmode.Enabled = !gridlock.Checked; slicesV.Enabled = (mode == GridLockMode.NONE || mode == GridLockMode.HORIZONTAL);
interphmode.Enabled = !gridlock.Checked; interphmode.Enabled = slicesH.Enabled;
reset.Enabled = !gridlock.Checked; interpvmode.Enabled = slicesV.Enabled;
reset.Enabled = (mode != GridLockMode.BOTH);
if(!blockevents && OnGridLockChanged != null) OnGridLockChanged(this, EventArgs.Empty); if(!blockevents && OnGridLockModeChanged != null) OnGridLockModeChanged(this, EventArgs.Empty);
} }
private void interpmode_DropDownClosed(object sender, EventArgs e) private void interpmode_DropDownClosed(object sender, EventArgs e)
@ -63,9 +75,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
private void reset_Click(object sender, EventArgs e) private void reset_Click(object sender, EventArgs e)
{ {
GridLockMode mode = (GridLockMode)gridlockmode.SelectedIndex;
blockevents = true; blockevents = true;
slicesH.Value = 3; if((mode == GridLockMode.NONE || mode == GridLockMode.VERTICAL)) slicesH.Value = 3;
slicesV.Value = 3; if(mode == GridLockMode.NONE || mode == GridLockMode.HORIZONTAL) slicesV.Value = 3;
blockevents = false; blockevents = false;
if(OnValueChanged != null) OnValueChanged(this, EventArgs.Empty); if(OnValueChanged != null) OnValueChanged(this, EventArgs.Empty);

View file

@ -9,9 +9,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
public event EventHandler OnContinuousDrawingChanged; public event EventHandler OnContinuousDrawingChanged;
private bool blockevents; private bool blockevents;
private static int radiusValue;
private static int subdivsValue;
public int BevelWidth { get { return (int)radius.Value; } set { blockevents = true; radius.Value = value; blockevents = false; } } public int BevelWidth { get { return (int)radius.Value; } set { blockevents = true; radius.Value = value; blockevents = false; } }
public int MaxBevelWidth { get { return (int)radius.Maximum; } set { radius.Maximum = value; } } public int MaxBevelWidth { get { return (int)radius.Maximum; } set { radius.Maximum = value; } }
public int MinBevelWidth { get { return (int)radius.Minimum; } set { radius.Minimum = value; } } public int MinBevelWidth { get { return (int)radius.Minimum; } set { radius.Minimum = value; } }
@ -27,8 +24,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
public void Register() public void Register()
{ {
radius.Value = radiusValue;
subdivs.Value = subdivsValue;
radius.ValueChanged += ValueChanged; radius.ValueChanged += ValueChanged;
subdivs.ValueChanged += ValueChanged; subdivs.ValueChanged += ValueChanged;
@ -54,8 +49,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
private void ValueChanged(object sender, EventArgs e) private void ValueChanged(object sender, EventArgs e)
{ {
radiusValue = (int)radius.Value;
subdivsValue = (int)subdivs.Value;
if(!blockevents && OnValueChanged != null) OnValueChanged(this, EventArgs.Empty); if(!blockevents && OnValueChanged != null) OnValueChanged(this, EventArgs.Empty);
} }