From a9abec5dd1b62751aa9fd8adbe01042f5af6cdf2 Mon Sep 17 00:00:00 2001 From: Ged Murphy Date: Thu, 6 Mar 2008 15:01:00 +0000 Subject: [PATCH] add missing files svn path=/trunk/tools/RosTE/; revision=681 --- GUI/DebugForm.Designer.cs | 88 ++++++++++++++++++++++++++++ GUI/DebugForm.cs | 96 ++++++++++++++++++++++++++++++ GUI/DebugForm.resx | 120 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 304 insertions(+) create mode 100644 GUI/DebugForm.Designer.cs create mode 100644 GUI/DebugForm.cs create mode 100644 GUI/DebugForm.resx diff --git a/GUI/DebugForm.Designer.cs b/GUI/DebugForm.Designer.cs new file mode 100644 index 0000000..3606577 --- /dev/null +++ b/GUI/DebugForm.Designer.cs @@ -0,0 +1,88 @@ +namespace RosTEGUI +{ + partial class DebugForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.errorText = new System.Windows.Forms.TextBox(); + this.errorCloseBtn = new System.Windows.Forms.Button(); + this.errorCopyBtn = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // errorText + // + this.errorText.Location = new System.Drawing.Point(12, 12); + this.errorText.Multiline = true; + this.errorText.Name = "errorText"; + this.errorText.ReadOnly = true; + this.errorText.Size = new System.Drawing.Size(436, 244); + this.errorText.TabIndex = 0; + // + // errorCloseBtn + // + this.errorCloseBtn.Location = new System.Drawing.Point(373, 262); + this.errorCloseBtn.Name = "errorCloseBtn"; + this.errorCloseBtn.Size = new System.Drawing.Size(75, 23); + this.errorCloseBtn.TabIndex = 1; + this.errorCloseBtn.Text = "Close"; + this.errorCloseBtn.UseVisualStyleBackColor = true; + this.errorCloseBtn.Click += new System.EventHandler(this.errorCloseBtn_Click); + // + // errorCopyBtn + // + this.errorCopyBtn.Location = new System.Drawing.Point(12, 262); + this.errorCopyBtn.Name = "errorCopyBtn"; + this.errorCopyBtn.Size = new System.Drawing.Size(75, 23); + this.errorCopyBtn.TabIndex = 2; + this.errorCopyBtn.Text = "Copy"; + this.errorCopyBtn.UseVisualStyleBackColor = true; + this.errorCopyBtn.Click += new System.EventHandler(this.errorCopyBtn_Click); + // + // DebugForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(460, 290); + this.Controls.Add(this.errorCopyBtn); + this.Controls.Add(this.errorCloseBtn); + this.Controls.Add(this.errorText); + this.MaximizeBox = false; + this.Name = "DebugForm"; + this.ShowIcon = false; + this.Text = "Debug"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox errorText; + private System.Windows.Forms.Button errorCloseBtn; + private System.Windows.Forms.Button errorCopyBtn; + } +} \ No newline at end of file diff --git a/GUI/DebugForm.cs b/GUI/DebugForm.cs new file mode 100644 index 0000000..e011de0 --- /dev/null +++ b/GUI/DebugForm.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +namespace RosTEGUI +{ + public partial class DebugForm : Form + { + public DebugForm() + { + InitializeComponent(); + } + + public void AddMessage(string message, string exception, string trace) + { + errorText.Text = message + " : " + exception + "\n\t" + trace; + } + + private void errorCloseBtn_Click(object sender, EventArgs e) + { + Debug.DoDebug = false; + Close(); + } + + private void errorCopyBtn_Click(object sender, EventArgs e) + { + Clipboard.SetText(errorText.Text); + } + } + + public static class Debug + { + static DebugForm df = null; + static bool doDebug = false; + + public static bool DoDebug + { + set { doDebug = value; } + get { return doDebug; } + } + + public static void TurnDebuggingOn() + { + if (df == null) + { + df = new DebugForm(); + df.Show(); + } + + DoDebug = true; + } + + public static void TurnDebuggingOff() + { + if (df != null) + { + df.Close(); + df = null; + } + + DoDebug = false; + } + + public static void LogMessage(string message) + { + LogMessage(message, null, null, false); + } + + public static void LogMessage(string message, string exception) + { + LogMessage(message, exception, null, false); + } + + public static void LogMessage(string message, string exception, string trace) + { + LogMessage(message, exception, trace, false); + } + + public static void LogMessage(string message, string exception, string trace, bool bForce) + { + if (df == null && bForce) + { + df = new DebugForm(); + df.Show(); + df.AddMessage(message, exception, trace); + } + + if (DoDebug) + df.AddMessage(message, null, null); + } + } +} \ No newline at end of file diff --git a/GUI/DebugForm.resx b/GUI/DebugForm.resx new file mode 100644 index 0000000..ff31a6d --- /dev/null +++ b/GUI/DebugForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file