SMS - Vdp Viewer - save screenshot to file menu items
This commit is contained in:
parent
66d64f816c
commit
471a2f5cf0
|
@ -2,11 +2,15 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
using BizHawk.Client.Common;
|
||||||
|
|
||||||
namespace BizHawk.Client.EmuHawk
|
namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
public partial class BmpView : Control
|
public partial class BmpView : Control
|
||||||
|
@ -83,5 +87,51 @@ namespace BizHawk.Client.EmuHawk
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SaveFile()
|
||||||
|
{
|
||||||
|
string path = PathManager.MakeAbsolutePath(
|
||||||
|
Global.Config.PathEntries[Global.Emulator.SystemId, "Screenshots"].Path,
|
||||||
|
Global.Emulator.SystemId);
|
||||||
|
|
||||||
|
DirectoryInfo di = new DirectoryInfo(path);
|
||||||
|
|
||||||
|
if (!di.Exists)
|
||||||
|
{
|
||||||
|
di.Create();
|
||||||
|
}
|
||||||
|
|
||||||
|
var sfd = new SaveFileDialog
|
||||||
|
{
|
||||||
|
FileName = PathManager.FilesystemSafeName(Global.Game) + "-Palettes",
|
||||||
|
InitialDirectory = path,
|
||||||
|
Filter = "PNG (*.png)|*.png|Bitmap (*.bmp)|*.bmp|All Files|*.*",
|
||||||
|
RestoreDirectory = true
|
||||||
|
};
|
||||||
|
|
||||||
|
var result = sfd.ShowHawkDialog();
|
||||||
|
if (result != DialogResult.OK)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var file = new FileInfo(sfd.FileName);
|
||||||
|
var b = this.bmp;
|
||||||
|
|
||||||
|
ImageFormat i;
|
||||||
|
string extension = file.Extension.ToUpper();
|
||||||
|
|
||||||
|
switch (extension)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case ".PNG":
|
||||||
|
i = ImageFormat.Png;
|
||||||
|
break;
|
||||||
|
case ".BMP":
|
||||||
|
i = ImageFormat.Bmp;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
b.Save(file.FullName, i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,17 @@ namespace BizHawk.Client.EmuHawk
|
||||||
Restart();
|
Restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void RefreshFloatingWindowControl()
|
||||||
|
{
|
||||||
|
Owner = Global.Config.SmsVdpSettings.FloatingWindow ? null : GlobalWin.MainForm;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnShown(EventArgs e)
|
||||||
|
{
|
||||||
|
RefreshFloatingWindowControl();
|
||||||
|
base.OnShown(e);
|
||||||
|
}
|
||||||
|
|
||||||
public void UpdateValues()
|
public void UpdateValues()
|
||||||
{
|
{
|
||||||
UpdateDisplay();
|
UpdateDisplay();
|
||||||
|
@ -322,6 +333,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
private void FloatingWindowMenuItem_Click(object sender, EventArgs e)
|
private void FloatingWindowMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Global.Config.PceCdlSettings.FloatingWindow ^= true;
|
Global.Config.PceCdlSettings.FloatingWindow ^= true;
|
||||||
|
RefreshFloatingWindowControl();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RestoreDefaultSettingsMenuItem_Click(object sender, EventArgs e)
|
private void RestoreDefaultSettingsMenuItem_Click(object sender, EventArgs e)
|
||||||
|
|
|
@ -38,12 +38,16 @@
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
this.menuStrip1 = new MenuStripEx();
|
this.menuStrip1 = new MenuStripEx();
|
||||||
this.FileSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
this.FileSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.saveTilesScreenshotToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
this.CloseMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.CloseMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.OptionsSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
this.OptionsSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.AutoloadMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.AutoloadMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.SaveWindowPositionMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.SaveWindowPositionMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.AlwaysOnTopMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.AlwaysOnTopMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.FloatingWindowMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.FloatingWindowMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.savePalettesScrenshotToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.saveBGScreenshotToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.groupBox1.SuspendLayout();
|
this.groupBox1.SuspendLayout();
|
||||||
this.groupBox2.SuspendLayout();
|
this.groupBox2.SuspendLayout();
|
||||||
this.groupBox3.SuspendLayout();
|
this.groupBox3.SuspendLayout();
|
||||||
|
@ -129,16 +133,32 @@
|
||||||
// FileSubMenu
|
// FileSubMenu
|
||||||
//
|
//
|
||||||
this.FileSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.FileSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.saveTilesScreenshotToolStripMenuItem,
|
||||||
|
this.savePalettesScrenshotToolStripMenuItem,
|
||||||
|
this.saveBGScreenshotToolStripMenuItem,
|
||||||
|
this.toolStripSeparator1,
|
||||||
this.CloseMenuItem});
|
this.CloseMenuItem});
|
||||||
this.FileSubMenu.Name = "FileSubMenu";
|
this.FileSubMenu.Name = "FileSubMenu";
|
||||||
this.FileSubMenu.Size = new System.Drawing.Size(37, 20);
|
this.FileSubMenu.Size = new System.Drawing.Size(37, 20);
|
||||||
this.FileSubMenu.Text = "&File";
|
this.FileSubMenu.Text = "&File";
|
||||||
//
|
//
|
||||||
|
// saveTilesScreenshotToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.saveTilesScreenshotToolStripMenuItem.Name = "saveTilesScreenshotToolStripMenuItem";
|
||||||
|
this.saveTilesScreenshotToolStripMenuItem.Size = new System.Drawing.Size(206, 22);
|
||||||
|
this.saveTilesScreenshotToolStripMenuItem.Text = "Save Tiles Screenshot...";
|
||||||
|
this.saveTilesScreenshotToolStripMenuItem.Click += new System.EventHandler(this.saveTilesScreenshotToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// toolStripSeparator1
|
||||||
|
//
|
||||||
|
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||||
|
this.toolStripSeparator1.Size = new System.Drawing.Size(203, 6);
|
||||||
|
//
|
||||||
// CloseMenuItem
|
// CloseMenuItem
|
||||||
//
|
//
|
||||||
this.CloseMenuItem.Name = "CloseMenuItem";
|
this.CloseMenuItem.Name = "CloseMenuItem";
|
||||||
this.CloseMenuItem.ShortcutKeyDisplayString = "Alt+F4";
|
this.CloseMenuItem.ShortcutKeyDisplayString = "Alt+F4";
|
||||||
this.CloseMenuItem.Size = new System.Drawing.Size(145, 22);
|
this.CloseMenuItem.Size = new System.Drawing.Size(206, 22);
|
||||||
this.CloseMenuItem.Text = "&Close";
|
this.CloseMenuItem.Text = "&Close";
|
||||||
this.CloseMenuItem.Click += new System.EventHandler(this.CloseMenuItem_Click);
|
this.CloseMenuItem.Click += new System.EventHandler(this.CloseMenuItem_Click);
|
||||||
//
|
//
|
||||||
|
@ -182,7 +202,21 @@
|
||||||
this.FloatingWindowMenuItem.Text = "Floating Window";
|
this.FloatingWindowMenuItem.Text = "Floating Window";
|
||||||
this.FloatingWindowMenuItem.Click += new System.EventHandler(this.FloatingWindowMenuItem_Click);
|
this.FloatingWindowMenuItem.Click += new System.EventHandler(this.FloatingWindowMenuItem_Click);
|
||||||
//
|
//
|
||||||
// VDPViewer
|
// savePalettesScrenshotToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.savePalettesScrenshotToolStripMenuItem.Name = "savePalettesScrenshotToolStripMenuItem";
|
||||||
|
this.savePalettesScrenshotToolStripMenuItem.Size = new System.Drawing.Size(206, 22);
|
||||||
|
this.savePalettesScrenshotToolStripMenuItem.Text = "Save Palettes Screnshot...";
|
||||||
|
this.savePalettesScrenshotToolStripMenuItem.Click += new System.EventHandler(this.savePalettesScrenshotToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// saveBGScreenshotToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.saveBGScreenshotToolStripMenuItem.Name = "saveBGScreenshotToolStripMenuItem";
|
||||||
|
this.saveBGScreenshotToolStripMenuItem.Size = new System.Drawing.Size(206, 22);
|
||||||
|
this.saveBGScreenshotToolStripMenuItem.Text = "Save BG Screenshot...";
|
||||||
|
this.saveBGScreenshotToolStripMenuItem.Click += new System.EventHandler(this.saveBGScreenshotToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// SmsVDPViewer
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
@ -196,7 +230,7 @@
|
||||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||||
this.KeyPreview = true;
|
this.KeyPreview = true;
|
||||||
this.MainMenuStrip = this.menuStrip1;
|
this.MainMenuStrip = this.menuStrip1;
|
||||||
this.Name = "VDPViewer";
|
this.Name = "SmsVDPViewer";
|
||||||
this.Text = "VDP Viewer";
|
this.Text = "VDP Viewer";
|
||||||
this.Load += new System.EventHandler(this.VDPViewer_Load);
|
this.Load += new System.EventHandler(this.VDPViewer_Load);
|
||||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.VDPViewer_KeyDown);
|
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.VDPViewer_KeyDown);
|
||||||
|
@ -227,5 +261,9 @@
|
||||||
private System.Windows.Forms.ToolStripMenuItem SaveWindowPositionMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem SaveWindowPositionMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem AlwaysOnTopMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem AlwaysOnTopMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem FloatingWindowMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem FloatingWindowMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem saveTilesScreenshotToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem savePalettesScrenshotToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem saveBGScreenshotToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -260,5 +260,20 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
Global.Config.SmsVdpAutoLoad ^= true;
|
Global.Config.SmsVdpAutoLoad ^= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void saveTilesScreenshotToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
bmpViewTiles.SaveFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void savePalettesScrenshotToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
bmpViewPalette.SaveFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveBGScreenshotToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
bmpViewBG.SaveFile();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue