summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2005-06-06 23:30:31 +0000
committerIan C <ianc@noddybox.co.uk>2005-06-06 23:30:31 +0000
commita8fc0aaabb8b706a583caa43e16a852b49875b99 (patch)
tree439369137f34898266c203bb38f68e97ce9f4bb7
parent5b0aef0013e47217a3c207297a6f61bb3b37827c (diff)
Initial importHEADmaster
-rw-r--r--.cvsignore1
-rw-r--r--AssemblyInfo.cs32
-rw-r--r--GfxView.MainForm.resourcesbin0 -> 3424 bytes
-rw-r--r--GfxView.cmbx16
-rw-r--r--GfxView.prjx26
-rw-r--r--MainForm.cs157
6 files changed, 232 insertions, 0 deletions
diff --git a/.cvsignore b/.cvsignore
new file mode 100644
index 0000000..c5e82d7
--- /dev/null
+++ b/.cvsignore
@@ -0,0 +1 @@
+bin \ No newline at end of file
diff --git a/AssemblyInfo.cs b/AssemblyInfo.cs
new file mode 100644
index 0000000..0e5b82c
--- /dev/null
+++ b/AssemblyInfo.cs
@@ -0,0 +1,32 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following
+// attributes.
+//
+// change them to the information which is associated with the assembly
+// you compile.
+
+[assembly: AssemblyTitle("")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has following format :
+//
+// Major.Minor.Build.Revision
+//
+// You can specify all values by your own or you can build default build and revision
+// numbers with the '*' character (the default):
+
+[assembly: AssemblyVersion("1.0.*")]
+
+// The following attributes specify the key for the sign of your assembly. See the
+// .NET Framework documentation for more information about signing.
+// This is not required, if you don't want signing let these attributes like they're.
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("")]
diff --git a/GfxView.MainForm.resources b/GfxView.MainForm.resources
new file mode 100644
index 0000000..d959688
--- /dev/null
+++ b/GfxView.MainForm.resources
Binary files differ
diff --git a/GfxView.cmbx b/GfxView.cmbx
new file mode 100644
index 0000000..0e252e6
--- /dev/null
+++ b/GfxView.cmbx
@@ -0,0 +1,16 @@
+<Combine fileversion="1.0" name="GfxView" description="">
+ <StartMode startupentry="GfxView" single="True">
+ <Execute entry="GfxView" type="None" />
+ </StartMode>
+ <Entries>
+ <Entry filename=".\.\GfxView.prjx" />
+ </Entries>
+ <Configurations active="Debug">
+ <Configuration name="Release">
+ <Entry name="GfxView" configurationname="Debug" build="False" />
+ </Configuration>
+ <Configuration name="Debug">
+ <Entry name="GfxView" configurationname="Debug" build="False" />
+ </Configuration>
+ </Configurations>
+</Combine> \ No newline at end of file
diff --git a/GfxView.prjx b/GfxView.prjx
new file mode 100644
index 0000000..4c90aae
--- /dev/null
+++ b/GfxView.prjx
@@ -0,0 +1,26 @@
+<Project name="GfxView" standardNamespace="GfxView" description="" newfilesearch="None" enableviewstate="True" version="1.1" projecttype="C#">
+ <Contents>
+ <File name=".\MainForm.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
+ <File name=".\AssemblyInfo.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
+ <File name=".\GfxView.MainForm.resources" subtype="Code" buildaction="EmbedAsResource" dependson="" data="" />
+ </Contents>
+ <References />
+ <DeploymentInformation target="" script="" strategy="File" />
+ <Configuration runwithwarnings="True" name="Debug">
+ <CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" target="WinExe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" />
+ <Execution commandlineparameters="" consolepause="False" />
+ <Output directory="..\bin\Debug" assembly="GfxView" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" />
+ </Configuration>
+ <Configurations active="Debug">
+ <Configuration runwithwarnings="True" name="Debug">
+ <CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" target="WinExe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" />
+ <Execution commandlineparameters="" consolepause="False" />
+ <Output directory="..\bin\Debug" assembly="GfxView" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" />
+ </Configuration>
+ <Configuration runwithwarnings="True" name="Release">
+ <CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="" warninglevel="4" nowarn="" includedebuginformation="False" optimize="True" unsafecodeallowed="False" generateoverflowchecks="False" mainclass="" target="WinExe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" />
+ <Execution commandlineparameters="" consolepause="False" />
+ <Output directory="..\bin\Release" assembly="GfxView" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" />
+ </Configuration>
+ </Configurations>
+</Project> \ No newline at end of file
diff --git a/MainForm.cs b/MainForm.cs
new file mode 100644
index 0000000..7eae71e
--- /dev/null
+++ b/MainForm.cs
@@ -0,0 +1,157 @@
+// GfxView - Simple GFX viewer
+// Copyright (C) 2005 Ian Cowburn
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// $Id$
+//
+using System;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Drawing.Imaging;
+using System.Windows.Forms;
+
+namespace GfxView
+{
+ /// <summary>
+ /// Description of MainForm.
+ /// </summary>
+ public class MainForm : System.Windows.Forms.Form
+ {
+ private System.Windows.Forms.PictureBox m_gfx;
+ private int m_height;
+ private double m_size;
+ private string m_file;
+
+ public MainForm(string file)
+ {
+ //
+ // The InitializeComponent() call is required for Windows Forms designer support.
+ //
+ InitializeComponent();
+
+ m_file=file;
+ m_gfx.Image=Bitmap.FromFile(file);
+
+ m_height=m_gfx.Image.Height;
+
+ m_size=1.0;
+
+ while(m_size>0.1 && (Screen.PrimaryScreen.WorkingArea.Height < (m_height*m_size)))
+ {
+ m_size-=0.01;
+ }
+
+ SetSize();
+ }
+
+ [STAThread]
+ public static void Main(string[] args)
+ {
+ string file=null;
+
+ if (args.Length>0)
+ {
+ file=args[0];
+ }
+ else
+ {
+ OpenFileDialog fsel=new OpenFileDialog();
+
+ if (fsel.ShowDialog()==DialogResult.OK)
+ {
+ file=fsel.FileName;
+ }
+ }
+
+ if (file!=null)
+ {
+ try
+ {
+ Application.Run(new MainForm(file));
+ }
+ catch (Exception e)
+ {
+ MessageBox.Show(e.Message,"Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
+ }
+ }
+ }
+
+ #region Windows Forms Designer generated code
+ /// <summary>
+ /// This method is required for Windows Forms designer support.
+ /// Do not change the method contents inside the source code editor. The Forms designer might
+ /// not be able to load this method if it was changed manually.
+ /// </summary>
+ private void InitializeComponent() {
+ this.m_gfx = new System.Windows.Forms.PictureBox();
+ this.SuspendLayout();
+ //
+ // m_gfx
+ //
+ this.m_gfx.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.m_gfx.Location = new System.Drawing.Point(0, 0);
+ this.m_gfx.Name = "m_gfx";
+ this.m_gfx.Size = new System.Drawing.Size(292, 266);
+ this.m_gfx.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
+ this.m_gfx.TabIndex = 0;
+ this.m_gfx.TabStop = false;
+ //
+ // MainForm
+ //
+ this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
+ this.ClientSize = new System.Drawing.Size(292, 266);
+ this.Controls.Add(this.m_gfx);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
+ this.Name = "MainForm";
+ this.Text = "MainForm";
+ this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.OnKey);
+ this.ResumeLayout(false);
+ }
+ #endregion
+
+ private void SetSize()
+ {
+ Width=(int)(m_gfx.Image.Width*m_size);
+ Height=(int)(m_gfx.Image.Height*m_size);
+
+ Text=m_file + " [" + (m_size*100).ToString() + "%]";
+ }
+
+ void OnKey(object sender, System.Windows.Forms.KeyPressEventArgs e)
+ {
+ switch(Char.ToLower(e.KeyChar))
+ {
+ case 'q':
+ Close();
+ break;
+
+ case '+':
+ m_size+=0.1;
+ SetSize();
+ break;
+
+ case '-':
+ m_size=Math.Max(0.01,m_size-0.1);
+ SetSize();
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ }
+}