mirror of
https://github.com/kwsch/NHSE.git
synced 2026-10-01 06:16:38 -05:00
Continued testing
Items now render without error in the map view, and repositioning the view works.
This commit is contained in:
@@ -48,7 +48,7 @@ private void InitializeComponent()
|
||||
NUD_Layer = new System.Windows.Forms.NumericUpDown();
|
||||
L_Layer = new System.Windows.Forms.Label();
|
||||
TT_Hover = new System.Windows.Forms.ToolTip(components);
|
||||
PB_Acre = new System.Windows.Forms.PictureBox();
|
||||
PB_Viewport = new System.Windows.Forms.PictureBox();
|
||||
TR_Transparency = new System.Windows.Forms.TrackBar();
|
||||
CHK_NoOverwrite = new System.Windows.Forms.CheckBox();
|
||||
CHK_AutoExtension = new System.Windows.Forms.CheckBox();
|
||||
@@ -155,7 +155,7 @@ private void InitializeComponent()
|
||||
((System.ComponentModel.ISupportInitialize)PB_Map).BeginInit();
|
||||
CM_Picture.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)NUD_Layer).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)PB_Acre).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)PB_Viewport).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)TR_Transparency).BeginInit();
|
||||
CM_Remove.SuspendLayout();
|
||||
TC_Editor.SuspendLayout();
|
||||
@@ -384,18 +384,18 @@ private void InitializeComponent()
|
||||
//
|
||||
// PB_Acre
|
||||
//
|
||||
PB_Acre.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
PB_Acre.ContextMenuStrip = CM_Click;
|
||||
PB_Acre.Location = new System.Drawing.Point(14, 16);
|
||||
PB_Acre.Margin = new System.Windows.Forms.Padding(4);
|
||||
PB_Acre.Name = "PB_Acre";
|
||||
PB_Acre.Size = new System.Drawing.Size(514, 514);
|
||||
PB_Acre.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
|
||||
PB_Acre.TabIndex = 28;
|
||||
PB_Acre.TabStop = false;
|
||||
PB_Acre.MouseClick += PB_Acre_MouseClick;
|
||||
PB_Acre.MouseDown += PB_Acre_MouseDown;
|
||||
PB_Acre.MouseMove += PB_Acre_MouseMove;
|
||||
PB_Viewport.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
PB_Viewport.ContextMenuStrip = CM_Click;
|
||||
PB_Viewport.Location = new System.Drawing.Point(14, 16);
|
||||
PB_Viewport.Margin = new System.Windows.Forms.Padding(4);
|
||||
PB_Viewport.Name = "PB_Viewport";
|
||||
PB_Viewport.Size = new System.Drawing.Size(514, 514);
|
||||
PB_Viewport.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
|
||||
PB_Viewport.TabIndex = 28;
|
||||
PB_Viewport.TabStop = false;
|
||||
PB_Viewport.MouseClick += ViewportMouseClick;
|
||||
PB_Viewport.MouseDown += ViewportMouseDown;
|
||||
PB_Viewport.MouseMove += ViewportMouseMove;
|
||||
//
|
||||
// TR_Transparency
|
||||
//
|
||||
@@ -1409,7 +1409,7 @@ private void InitializeComponent()
|
||||
Controls.Add(RB_Terrain);
|
||||
Controls.Add(RB_Item);
|
||||
Controls.Add(TC_Editor);
|
||||
Controls.Add(PB_Acre);
|
||||
Controls.Add(PB_Viewport);
|
||||
Controls.Add(L_Layer);
|
||||
Controls.Add(NUD_Layer);
|
||||
Controls.Add(L_Coordinates);
|
||||
@@ -1434,7 +1434,7 @@ private void InitializeComponent()
|
||||
((System.ComponentModel.ISupportInitialize)PB_Map).EndInit();
|
||||
CM_Picture.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)NUD_Layer).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)PB_Acre).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)PB_Viewport).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)TR_Transparency).EndInit();
|
||||
CM_Remove.ResumeLayout(false);
|
||||
TC_Editor.ResumeLayout(false);
|
||||
@@ -1490,7 +1490,7 @@ private void InitializeComponent()
|
||||
private System.Windows.Forms.NumericUpDown NUD_Layer;
|
||||
private System.Windows.Forms.Label L_Layer;
|
||||
private System.Windows.Forms.ToolTip TT_Hover;
|
||||
private System.Windows.Forms.PictureBox PB_Acre;
|
||||
private System.Windows.Forms.PictureBox PB_Viewport;
|
||||
private System.Windows.Forms.TrackBar TR_Transparency;
|
||||
private System.Windows.Forms.CheckBox CHK_NoOverwrite;
|
||||
private System.Windows.Forms.CheckBox CHK_AutoExtension;
|
||||
|
||||
@@ -52,10 +52,10 @@ public FieldItemEditor(MainSave sav)
|
||||
this.TranslateInterface(GameInfo.CurrentLanguage);
|
||||
|
||||
// Read the expected scale from the control.
|
||||
var scale = (PB_Acre.Width - 2) / LayerFieldItem.TilesPerAcreDim; // 1px border
|
||||
var scale = (PB_Viewport.Width - 2) / LayerFieldItem.TilesPerAcreDim; // 1px border
|
||||
SAV = sav;
|
||||
Editor = MapEditor.FromSaveFile(sav);
|
||||
Editor.MapScale = scale;
|
||||
Editor.MapScale = 1;
|
||||
Editor.ViewScale = scale;
|
||||
Renderer = new MapRenderer(Editor);
|
||||
|
||||
@@ -128,7 +128,7 @@ private void ChangeViewToAcre(int acre)
|
||||
private void LoadItemGridAcre()
|
||||
{
|
||||
ReloadItems();
|
||||
ReloadAcreBackground();
|
||||
ReloadViewportBackground();
|
||||
UpdateArrowVisibility();
|
||||
}
|
||||
|
||||
@@ -153,26 +153,26 @@ private void SetMapForegroundImage(Bitmap img)
|
||||
PB_Map.Image = img;
|
||||
}
|
||||
|
||||
private void ReloadAcreBackground()
|
||||
private void ReloadViewportBackground()
|
||||
{
|
||||
var tbuild = (byte)TR_BuildingTransparency.Value;
|
||||
var tterrain = (byte)TR_Terrain.Value;
|
||||
var img = Renderer.UpdateViewportTerrain(L_Coordinates.Font, tbuild, tterrain, SelectedBuildingIndex);
|
||||
PB_Acre.BackgroundImage = img;
|
||||
PB_Acre.Invalidate(); // background image reassigning to same img doesn't redraw; force it
|
||||
PB_Viewport.BackgroundImage = img;
|
||||
PB_Viewport.Invalidate(); // background image reassigning to same img doesn't redraw; force it
|
||||
}
|
||||
|
||||
private void ReloadAcreItemGrid() => PB_Acre.Image = Renderer.UpdateViewportItems(GetItemTransparency());
|
||||
private void ReloadViewportItems() => PB_Viewport.Image = Renderer.UpdateViewportItems(GetItemTransparency());
|
||||
|
||||
public void ReloadItems()
|
||||
{
|
||||
ReloadAcreItemGrid();
|
||||
ReloadViewportItems();
|
||||
ReloadMapItemGrid();
|
||||
}
|
||||
|
||||
private void ReloadBuildingsTerrain()
|
||||
{
|
||||
ReloadAcreBackground();
|
||||
ReloadViewportBackground();
|
||||
ReloadMapBackground();
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ private void UpdateArrowVisibility()
|
||||
B_Right.Enabled = View.CanRight;
|
||||
}
|
||||
|
||||
private void PB_Acre_MouseClick(object sender, MouseEventArgs e)
|
||||
private void ViewportMouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (IsDragOperationActive)
|
||||
{
|
||||
@@ -370,9 +370,9 @@ private void UpdateHoveredCoordinates(MouseEventArgs e)
|
||||
HoverY &= 0x1F;
|
||||
}
|
||||
|
||||
private void PB_Acre_MouseDown(object sender, MouseEventArgs e) => ResetDrag();
|
||||
private void ViewportMouseDown(object sender, MouseEventArgs e) => ResetDrag();
|
||||
|
||||
private void PB_Acre_MouseMove(object sender, MouseEventArgs e)
|
||||
private void ViewportMouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
var l = CurrentLayer;
|
||||
if (e.Button == MouseButtons.Left && CHK_MoveOnDrag.Checked)
|
||||
@@ -409,7 +409,7 @@ private void PB_Acre_MouseMove(object sender, MouseEventArgs e)
|
||||
var isActive = flagLayer.GetIsActive(x, y);
|
||||
if (isActive)
|
||||
name = $"{name} [Active]";
|
||||
TT_Hover.SetToolTip(PB_Acre, name);
|
||||
TT_Hover.SetToolTip(PB_Viewport, name);
|
||||
SetCoordinateText(x, y);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user