From 2fe402b165732a722839dd620580f81d0d797fbb Mon Sep 17 00:00:00 2001 From: MaxED Date: Mon, 18 May 2015 18:49:15 +0000 Subject: [PATCH] Fixed, MAPINFO parser: properties, written like '667=CuteCaco' were not parsed, while '667 = CuteCaco' worked fine. Changed, Classic modes: increased maximum zoom level to 9000% (was 3000%). Added, General interface: added "800%" zoom level to the bottom toolbar zoom menu. Added, General interface: added "400%" and "800%" zoom levels to "View -> Zoom" menu. --- Source/Core/Editing/ClassicMode.cs | 20 +++++------ Source/Core/GZBuilder/GZDoom/MapinfoParser.cs | 6 ++-- Source/Core/Windows/MainForm.Designer.cs | 33 +++++++++++++++++++ Source/Core/Windows/MainForm.cs | 4 +-- 4 files changed, 45 insertions(+), 18 deletions(-) diff --git a/Source/Core/Editing/ClassicMode.cs b/Source/Core/Editing/ClassicMode.cs index 01421ca4..348d0b1d 100644 --- a/Source/Core/Editing/ClassicMode.cs +++ b/Source/Core/Editing/ClassicMode.cs @@ -37,7 +37,7 @@ namespace CodeImp.DoomBuilder.Editing { #region ================== Constants - private const float SCALE_MAX = 30f; + private const float SCALE_MAX = 90f; private const float SCALE_MIN = 0.01f; private const float SELECTION_BORDER_SIZE = 2f; private const int SELECTION_ALPHA = 200; @@ -224,7 +224,7 @@ namespace CodeImp.DoomBuilder.Editing } // This sets the view to be centered at x,y - private void ScrollTo(float x, float y) + /*private void ScrollTo(float x, float y) { // Scroll now renderer2d.PositionView(x, y); @@ -236,24 +236,23 @@ namespace CodeImp.DoomBuilder.Editing // Determine new unprojected mouse coordinates mousemappos = renderer2d.DisplayToMap(mousepos); General.MainWindow.UpdateCoordinates(mousemappos); - } + }*/ // This zooms private void ZoomBy(float deltaz) { - Vector2D zoompos, clientsize, diff; - float newscale; - + Vector2D zoompos; + // This will be the new zoom scale - newscale = renderer2d.Scale * deltaz; + float newscale = renderer2d.Scale * deltaz; // Limit scale if(newscale > SCALE_MAX) newscale = SCALE_MAX; if(newscale < SCALE_MIN) newscale = SCALE_MIN; // Get the dimensions of the display - clientsize = new Vector2D(General.Map.Graphics.RenderTarget.ClientSize.Width, - General.Map.Graphics.RenderTarget.ClientSize.Height); + Vector2D clientsize = new Vector2D(General.Map.Graphics.RenderTarget.ClientSize.Width, + General.Map.Graphics.RenderTarget.ClientSize.Height); // When mouse is inside display if(mouseinside) @@ -268,7 +267,7 @@ namespace CodeImp.DoomBuilder.Editing } // Calculate view position difference - diff = ((clientsize / newscale) - (clientsize / renderer2d.Scale)) * zoompos; + Vector2D diff = ((clientsize / newscale) - (clientsize / renderer2d.Scale)) * zoompos; // Zoom now renderer2d.PositionView(renderer2d.OffsetX - diff.x, renderer2d.OffsetY + diff.y); @@ -276,7 +275,6 @@ namespace CodeImp.DoomBuilder.Editing this.OnViewChanged(); // Redraw - //General.Map.Map.Update(); General.MainWindow.RedrawDisplay(); // Give a new mousemove event to update coordinates diff --git a/Source/Core/GZBuilder/GZDoom/MapinfoParser.cs b/Source/Core/GZBuilder/GZDoom/MapinfoParser.cs index 04d2b3d1..fb9cfbb3 100644 --- a/Source/Core/GZBuilder/GZDoom/MapinfoParser.cs +++ b/Source/Core/GZBuilder/GZDoom/MapinfoParser.cs @@ -43,7 +43,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom { // Syntax whitespace = "\n \t\r\u00A0"; - specialtokens = ",{}\n"; + specialtokens = ",{}=\n"; mapinfo = new MapInfo(); spawnnums = new Dictionary(); @@ -90,7 +90,6 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom if (token == "map" || token == "defaultmap" || token == "adddefaultmap") { - string curBlockName = token; switch(token) { case "map": @@ -308,7 +307,6 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom else if (token == "doublesky") { mapinfo.DoubleSky = true; - } //evenlighting else if (token == "evenlighting") @@ -323,7 +321,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom //block end else if (token == "}") { - return (curBlockName == "map" || ParseBlock(token, mapName)); + return ParseBlock(token, mapName); } } } diff --git a/Source/Core/Windows/MainForm.Designer.cs b/Source/Core/Windows/MainForm.Designer.cs index f3d4c8ff..60553221 100644 --- a/Source/Core/Windows/MainForm.Designer.cs +++ b/Source/Core/Windows/MainForm.Designer.cs @@ -239,6 +239,9 @@ namespace CodeImp.DoomBuilder.Windows this.dockerscollapser = new System.Windows.Forms.Timer(this.components); this.flowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel(); this.modecontrolsloolbar = new System.Windows.Forms.ToolStrip(); + this.item2zoom400 = new System.Windows.Forms.ToolStripMenuItem(); + this.item2zoom800 = new System.Windows.Forms.ToolStripMenuItem(); + this.itemzoom800 = new System.Windows.Forms.ToolStripMenuItem(); toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator(); toolStripSeparator12 = new System.Windows.Forms.ToolStripSeparator(); @@ -797,6 +800,8 @@ namespace CodeImp.DoomBuilder.Windows // menuzoom // this.menuzoom.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.item2zoom800, + this.item2zoom400, this.item2zoom200, this.item2zoom100, this.item2zoom50, @@ -1879,6 +1884,7 @@ namespace CodeImp.DoomBuilder.Windows this.buttonzoom.AutoToolTip = false; this.buttonzoom.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.buttonzoom.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.itemzoom800, this.itemzoom400, this.itemzoom200, this.itemzoom100, @@ -2219,6 +2225,30 @@ namespace CodeImp.DoomBuilder.Windows this.modecontrolsloolbar.Text = "toolStrip1"; this.modecontrolsloolbar.Visible = false; // + // item2zoom400 + // + this.item2zoom400.Name = "item2zoom400"; + this.item2zoom400.Size = new System.Drawing.Size(102, 22); + this.item2zoom400.Tag = "400"; + this.item2zoom400.Text = "400%"; + this.item2zoom400.Click += new System.EventHandler(this.itemzoomto_Click); + // + // item2zoom800 + // + this.item2zoom800.Name = "item2zoom800"; + this.item2zoom800.Size = new System.Drawing.Size(102, 22); + this.item2zoom800.Tag = "800"; + this.item2zoom800.Text = "800%"; + this.item2zoom800.Click += new System.EventHandler(this.itemzoomto_Click); + // + // itemzoom800 + // + this.itemzoom800.Name = "itemzoom800"; + this.itemzoom800.Size = new System.Drawing.Size(156, 22); + this.itemzoom800.Tag = "800"; + this.itemzoom800.Text = "800%"; + this.itemzoom800.Click += new System.EventHandler(this.itemzoomto_Click); + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); @@ -2465,5 +2495,8 @@ namespace CodeImp.DoomBuilder.Windows private ToolStripMenuItem modelsshowselection; private ToolStripMenuItem modelsshowall; private DebugConsole console; + private ToolStripMenuItem item2zoom400; + private ToolStripMenuItem item2zoom800; + private ToolStripMenuItem itemzoom800; } } \ No newline at end of file diff --git a/Source/Core/Windows/MainForm.cs b/Source/Core/Windows/MainForm.cs index f3fa0251..f45e11f0 100644 --- a/Source/Core/Windows/MainForm.cs +++ b/Source/Core/Windows/MainForm.cs @@ -960,8 +960,6 @@ namespace CodeImp.DoomBuilder.Windows // Zoom to a specified level private void itemzoomto_Click(object sender, EventArgs e) { - int zoom; - if(General.Map == null) return; // In classic mode? @@ -971,7 +969,7 @@ namespace CodeImp.DoomBuilder.Windows if(sender is ToolStripMenuItem) { // Get integral zoom level - zoom = int.Parse((sender as ToolStripMenuItem).Tag.ToString(), CultureInfo.InvariantCulture); + int zoom = int.Parse((sender as ToolStripMenuItem).Tag.ToString(), CultureInfo.InvariantCulture); // Zoom now (General.Editing.Mode as ClassicMode).SetZoom(zoom / 100f);