diff options
Diffstat (limited to 'About.cs')
-rw-r--r-- | About.cs | 212 |
1 files changed, 212 insertions, 0 deletions
diff --git a/About.cs b/About.cs new file mode 100644 index 0000000..8f9f98f --- /dev/null +++ b/About.cs @@ -0,0 +1,212 @@ +// GfxEd8 +// Copyright (C) 2004 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.Windows.Forms; +using System.Text; +using System.Reflection; +using GfxEdInterface; + +namespace GfxEd8 +{ + /// <summary> + /// Description of About + /// </summary> + public class About : System.Windows.Forms.Form + { + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.RichTextBox m_info; + private System.Windows.Forms.Button m_ok; + private System.Windows.Forms.ListBox m_plugin; + private System.Windows.Forms.Label m_gpl; + private System.Windows.Forms.Label m_title; + + public About() + { + // + // The InitializeComponent() call is required for Windows Forms designer support. + // + InitializeComponent(); + + StringBuilder s=new StringBuilder(); + + m_title.Text="GfxEd8 (c) Copyright 2004 Ian Cowburn"; + + s.Append("This program is distributed in the hope that it will be useful, "); + s.Append("but WITHOUT ANY WARRANTY; without even the implied warranty of "); + s.Append("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "); + s.Append("GNU General Public License for more details."); + + m_gpl.Text=s.ToString(); + + foreach (string n in PluginControl.Names) + { + m_plugin.Items.Add(n); + } + + m_plugin.SelectedIndex=0; + } + + #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_title = new System.Windows.Forms.Label(); + this.m_gpl = new System.Windows.Forms.Label(); + this.m_plugin = new System.Windows.Forms.ListBox(); + this.m_ok = new System.Windows.Forms.Button(); + this.m_info = new System.Windows.Forms.RichTextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // m_title + // + this.m_title.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.m_title.Location = new System.Drawing.Point(8, 8); + this.m_title.Name = "m_title"; + this.m_title.Size = new System.Drawing.Size(504, 32); + this.m_title.TabIndex = 7; + this.m_title.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // m_gpl + // + this.m_gpl.Location = new System.Drawing.Point(72, 48); + this.m_gpl.Name = "m_gpl"; + this.m_gpl.Size = new System.Drawing.Size(392, 56); + this.m_gpl.TabIndex = 0; + // + // m_plugin + // + this.m_plugin.Location = new System.Drawing.Point(8, 128); + this.m_plugin.Name = "m_plugin"; + this.m_plugin.Size = new System.Drawing.Size(504, 82); + this.m_plugin.Sorted = true; + this.m_plugin.TabIndex = 4; + this.m_plugin.SelectedIndexChanged += new System.EventHandler(this.OnSelectPlugin); + // + // m_ok + // + this.m_ok.Location = new System.Drawing.Point(424, 352); + this.m_ok.Name = "m_ok"; + this.m_ok.Size = new System.Drawing.Size(88, 24); + this.m_ok.TabIndex = 2; + this.m_ok.Text = "OK"; + this.m_ok.Click += new System.EventHandler(this.OnOK); + // + // m_info + // + this.m_info.BackColor = System.Drawing.SystemColors.Info; + this.m_info.Location = new System.Drawing.Point(8, 232); + this.m_info.Name = "m_info"; + this.m_info.ReadOnly = true; + this.m_info.Size = new System.Drawing.Size(504, 112); + this.m_info.TabIndex = 5; + this.m_info.Text = ""; + // + // label1 + // + this.label1.Location = new System.Drawing.Point(8, 112); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(96, 16); + this.label1.TabIndex = 3; + this.label1.Text = "Plugins:"; + // + // label2 + // + this.label2.Location = new System.Drawing.Point(8, 216); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(96, 16); + this.label2.TabIndex = 6; + this.label2.Text = "Plugin Info:"; + // + // About + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 14); + this.ClientSize = new System.Drawing.Size(522, 383); + this.Controls.Add(this.m_title); + this.Controls.Add(this.label2); + this.Controls.Add(this.m_plugin); + this.Controls.Add(this.label1); + this.Controls.Add(this.m_ok); + this.Controls.Add(this.m_gpl); + this.Controls.Add(this.m_info); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "About"; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "About GfxEd8"; + this.ResumeLayout(false); + } + #endregion + + + void OnOK(object sender, System.EventArgs e) + { + Close(); + } + + string GetSize(SpriteSize[] sz) + { + string ret="("; + bool first=true; + + foreach (SpriteSize s in sz) + { + if (!first) + { + ret+=", ("; + } + + ret+=s.ToString()+")"; + + first=false; + } + + return ret; + } + + void OnSelectPlugin(object sender, System.EventArgs e) + { + string name=m_plugin.Items[m_plugin.SelectedIndex].ToString(); + IPlugin i=PluginControl.Get(name); + Assembly a=PluginControl.GetAssembly(name); + + StringBuilder s=new StringBuilder(); + + s.Append("Author\t\t: "+i.Author+"\n"); + s.Append("Description\t: "+i.Description+"\n"); + s.Append("URL\t\t: "+i.URL+"\n"); + s.Append("Version\t\t: "+PluginControl.Version(name)+"\n"); + s.Append("Colours per sprite\t: "+i.MaxColours+"\n"); + s.Append("Supported sizes\t: "+GetSize(i.AllowedSizes)+"\n"); + s.Append("Location\t\t: "+a.Location+"\n"); + s.Append("CLR Version\t: "+a.ImageRuntimeVersion+"\n"); + + m_info.Text=s.ToString(); + } + + } +} |