annotate FrmDebugOutput.cs @ 36:6ab7ddc038f9

Re #121: Move all code to AGPL * Move all WinForms code to the GNU Affero General Public License * fix some copyright dates
author IBBoard <dev@ibboard.co.uk>
date Sat, 15 Aug 2009 10:15:00 +0000
parents 7c366fe55635
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
24
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
1 // This file (FrmDebugOutput.cs) is a part of the IBBoard.WarFoundry.GUI.WinForms project and is copyright 2009 IBBoard.
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
2 //
36
6ab7ddc038f9 Re #121: Move all code to AGPL
IBBoard <dev@ibboard.co.uk>
parents: 24
diff changeset
3 // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license.
24
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
4
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
5 using System;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
6 using System.Drawing;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
7 using System.Collections;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
8 using System.ComponentModel;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
9 using System.Text;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
10 using System.Windows.Forms;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
11 using IBBoard.Lang;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
12 using IBBoard.Logging;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
13 using IBBoard.Windows.Forms;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
14
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
15 namespace IBBoard.WarFoundry
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
16 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
17 /// <summary>
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
18 /// Summary description for FrmDebugOutput.
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
19 /// </summary>
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
20 public class FrmDebugOutput : IBBForm
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
21 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
22 private System.Windows.Forms.ListBox lstDebugItems;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
23 private System.Windows.Forms.ComboBox cmbDebugLevel;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
24 private System.Windows.Forms.Label lblDebugLevel;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
25 /// <summary>
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
26 /// Required designer variable.
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
27 /// </summary>
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
28 private System.ComponentModel.Container components = null;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
29 private System.Windows.Forms.ContextMenu contextMenu;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
30 private System.Windows.Forms.MenuItem miCopy;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
31 private System.Windows.Forms.TextBox txtDetail;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
32 private System.Windows.Forms.Splitter splitter1;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
33 private System.Windows.Forms.Panel panel1;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
34 //private int MAX_LIST_LENGTH = 50;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
35
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
36 public FrmDebugOutput()
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
37 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
38 //this.logger = logger;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
39 //logger.LogUpdatedEvent+=new IBBoard.Logging.Logger.LogUpdatedDelegate(logger_LogUpdatedEvent);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
40 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
41 // Required for Windows Form Designer support
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
42 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
43 InitializeComponent();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
44
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
45 /*if (LogLevels.Debug >= logger.LogLevel)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
46 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
47 cmbDebugLevel.Items.Add(LogLevels.Debug);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
48 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
49
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
50 if (LogLevels.Info >= logger.LogLevel)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
51 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
52 cmbDebugLevel.Items.Add(LogLevels.Info);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
53 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
54
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
55 if (LogLevels.Warning >= logger.LogLevel)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
56 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
57 cmbDebugLevel.Items.Add(LogLevels.Warning);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
58 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
59
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
60 if (LogLevels.Error >= logger.LogLevel)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
61 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
62 cmbDebugLevel.Items.Add(LogLevels.Error);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
63 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
64
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
65 if (LogLevels.Critical >= logger.LogLevel)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
66 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
67 cmbDebugLevel.Items.Add(LogLevels.Critical);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
68 }*/
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
69
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
70 this.Name = "DebugOutputForm";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
71
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
72 //cmbDebugLevel.SelectedItem = logger.LogLevel;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
73
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
74 Translation.Translate(this, true);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
75
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
76 fillDebugList();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
77 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
78
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
79 /// <summary>
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
80 /// Clean up any resources being used.
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
81 /// </summary>
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
82 protected override void Dispose( bool disposing )
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
83 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
84 if( disposing )
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
85 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
86 if(components != null)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
87 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
88 components.Dispose();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
89 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
90 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
91 base.Dispose( disposing );
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
92 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
93
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
94 #region Windows Form Designer generated code
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
95 /// <summary>
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
96 /// Required method for Designer support - do not modify
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
97 /// the contents of this method with the code editor.
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
98 /// </summary>
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
99 private void InitializeComponent()
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
100 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
101 this.lstDebugItems = new System.Windows.Forms.ListBox();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
102 this.contextMenu = new System.Windows.Forms.ContextMenu();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
103 this.miCopy = new System.Windows.Forms.MenuItem();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
104 this.cmbDebugLevel = new System.Windows.Forms.ComboBox();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
105 this.lblDebugLevel = new System.Windows.Forms.Label();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
106 this.txtDetail = new System.Windows.Forms.TextBox();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
107 this.splitter1 = new System.Windows.Forms.Splitter();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
108 this.panel1 = new System.Windows.Forms.Panel();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
109 this.SuspendLayout();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
110 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
111 // lstDebugItems
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
112 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
113 this.lstDebugItems.ContextMenu = this.contextMenu;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
114 this.lstDebugItems.Dock = System.Windows.Forms.DockStyle.Fill;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
115 this.lstDebugItems.IntegralHeight = false;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
116 this.lstDebugItems.Location = new System.Drawing.Point(0, 24);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
117 this.lstDebugItems.Name = "lstDebugItems";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
118 this.lstDebugItems.ScrollAlwaysVisible = true;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
119 this.lstDebugItems.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
120 this.lstDebugItems.Size = new System.Drawing.Size(656, 144);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
121 this.lstDebugItems.TabIndex = 0;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
122 this.lstDebugItems.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lstDebugItems_MouseDown);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
123 this.lstDebugItems.SelectedIndexChanged += new System.EventHandler(this.lstDebugItems_SelectedIndexChanged);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
124 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
125 // contextMenu
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
126 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
127 this.contextMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
128 this.miCopy});
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
129 this.contextMenu.Popup += new System.EventHandler(this.contextMenu_Popup);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
130 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
131 // miCopy
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
132 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
133 this.miCopy.Index = 0;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
134 this.miCopy.Text = "&Copy";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
135 this.miCopy.Click += new System.EventHandler(this.miCopy_Click);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
136 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
137 // cmbDebugLevel
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
138 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
139 this.cmbDebugLevel.Location = new System.Drawing.Point(190, 2);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
140 this.cmbDebugLevel.Name = "cmbDebugLevel";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
141 this.cmbDebugLevel.Size = new System.Drawing.Size(464, 21);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
142 this.cmbDebugLevel.TabIndex = 1;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
143 this.cmbDebugLevel.SelectedIndexChanged += new System.EventHandler(this.cmbDebugLevel_SelectedIndexChanged);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
144 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
145 // lblDebugLevel
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
146 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
147 this.lblDebugLevel.Location = new System.Drawing.Point(16, 0);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
148 this.lblDebugLevel.Name = "lblDebugLevel";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
149 this.lblDebugLevel.Size = new System.Drawing.Size(168, 21);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
150 this.lblDebugLevel.TabIndex = 2;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
151 this.lblDebugLevel.Text = "debug level:";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
152 this.lblDebugLevel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
153 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
154 // txtDetail
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
155 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
156 this.txtDetail.Dock = System.Windows.Forms.DockStyle.Bottom;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
157 this.txtDetail.Location = new System.Drawing.Point(0, 172);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
158 this.txtDetail.Multiline = true;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
159 this.txtDetail.Name = "txtDetail";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
160 this.txtDetail.ReadOnly = true;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
161 this.txtDetail.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
162 this.txtDetail.Size = new System.Drawing.Size(656, 64);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
163 this.txtDetail.TabIndex = 3;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
164 this.txtDetail.TabStop = false;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
165 this.txtDetail.Text = "";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
166 this.txtDetail.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtDetail_KeyDown);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
167 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
168 // splitter1
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
169 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
170 this.splitter1.Cursor = System.Windows.Forms.Cursors.HSplit;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
171 this.splitter1.Dock = System.Windows.Forms.DockStyle.Bottom;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
172 this.splitter1.Location = new System.Drawing.Point(0, 168);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
173 this.splitter1.MinExtra = 50;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
174 this.splitter1.MinSize = 50;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
175 this.splitter1.Name = "splitter1";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
176 this.splitter1.Size = new System.Drawing.Size(656, 4);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
177 this.splitter1.TabIndex = 4;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
178 this.splitter1.TabStop = false;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
179 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
180 // panel1
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
181 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
182 this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
183 this.panel1.Location = new System.Drawing.Point(0, 0);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
184 this.panel1.Name = "panel1";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
185 this.panel1.Size = new System.Drawing.Size(656, 24);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
186 this.panel1.TabIndex = 5;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
187 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
188 // FrmDebugOutput
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
189 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
190 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
191 this.ClientSize = new System.Drawing.Size(656, 236);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
192 this.Controls.Add(this.lblDebugLevel);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
193 this.Controls.Add(this.cmbDebugLevel);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
194 this.Controls.Add(this.lstDebugItems);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
195 this.Controls.Add(this.splitter1);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
196 this.Controls.Add(this.panel1);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
197 this.Controls.Add(this.txtDetail);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
198 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
199 this.Name = "FrmDebugOutput";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
200 this.ShowInTaskbar = false;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
201 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
202 this.Text = "FrmDebugOutput";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
203 this.ResumeLayout(false);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
204
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
205 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
206 #endregion
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
207
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
208 private void cmbDebugLevel_SelectedIndexChanged(object sender, System.EventArgs e)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
209 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
210 fillDebugList();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
211 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
212
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
213 private void fillDebugList()
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
214 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
215 lstDebugItems.Items.Clear();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
216 /*LogItem[] items = logger.GetLogItems((LogLevels)cmbDebugLevel.SelectedItem);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
217 int last = items.Length - 1;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
218 int stop = last - MAX_LIST_LENGTH;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
219
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
220 if (stop < 0)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
221 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
222 stop = 0;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
223 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
224
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
225 //reverse fill the list so that we can have newest items at the top
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
226 for (int i = last; i >= stop; i--)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
227 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
228 lstDebugItems.Items.Add(items[i]);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
229 }*/
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
230 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
231
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
232 private void logger_LogUpdatedEvent(LogItem item)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
233 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
234 /*if (item.Level >= (LogLevels)cmbDebugLevel.SelectedItem)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
235 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
236 lock (lstDebugItems)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
237 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
238 lstDebugItems.Items.Insert(0, item);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
239
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
240 if (lstDebugItems.Items.Count > MAX_LIST_LENGTH)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
241 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
242 lstDebugItems.Items.RemoveAt(lstDebugItems.Items.Count - 1);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
243 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
244 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
245 }*/
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
246 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
247
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
248 private void miCopy_Click(object sender, System.EventArgs e)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
249 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
250 if (lstDebugItems.SelectedIndices.Count==1)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
251 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
252 Clipboard.SetDataObject(lstDebugItems.SelectedItem.ToString());
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
253 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
254 else if (lstDebugItems.SelectedIndices.Count > 1)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
255 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
256 StringBuilder sb = new StringBuilder();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
257
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
258 foreach (int idx in lstDebugItems.SelectedIndices)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
259 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
260 sb.Append(lstDebugItems.Items[idx].ToString()+Environment.NewLine);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
261 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
262
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
263 Clipboard.SetDataObject(sb.ToString().Trim());
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
264 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
265 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
266
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
267 private void contextMenu_Popup(object sender, System.EventArgs e)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
268 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
269 foreach (MenuItem mi in contextMenu.MenuItems)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
270 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
271 mi.Visible = lstDebugItems.SelectedIndex > -1;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
272 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
273 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
274
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
275 private void lstDebugItems_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
276 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
277 if (e.Button == MouseButtons.Right)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
278 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
279 int idx = lstDebugItems.IndexFromPoint(e.X, e.Y);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
280
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
281 if (lstDebugItems.SelectedIndices.Contains(idx))
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
282 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
283 lstDebugItems.SelectedIndex = idx;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
284 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
285 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
286 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
287
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
288 private void lstDebugItems_SelectedIndexChanged(object sender, System.EventArgs e)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
289 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
290 if (lstDebugItems.SelectedIndex > -1)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
291 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
292 LogItem item = (LogItem)lstDebugItems.SelectedItem;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
293 txtDetail.Text = item.ToString() + Environment.NewLine + Environment.NewLine + "Stack Trace: "+ item.StackTrace;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
294 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
295 else
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
296 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
297 txtDetail.Text = "";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
298 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
299 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
300
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
301 private void txtDetail_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
302 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
303 if(e.KeyData == (Keys.Control|Keys.A) && e.Control)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
304 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
305 txtDetail.SelectAll();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
306 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
307 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
308 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
309 }