[pspplayer commit] r591 - in trunk/Noxa.Emulation.Psp.Player: . Debugger/Tools

0 views
Skip to first unread message

codesite...@google.com

unread,
Mar 24, 2008, 12:58:18 AM3/24/08
to psppla...@googlegroups.com
Author: ben.vanik
Date: Sun Mar 23 21:57:45 2008
New Revision: 591

Added:
trunk/Noxa.Emulation.Psp.Player/Debugger/Tools/LogControl.resx
Modified:
trunk/Noxa.Emulation.Psp.Player/Debugger/Tools/LogControl.Designer.cs
trunk/Noxa.Emulation.Psp.Player/Debugger/Tools/LogControl.cs
trunk/Noxa.Emulation.Psp.Player/Noxa.Emulation.Psp.Player.csproj

Log:
minor log tweaks
copy/clear options in context menu

Modified: trunk/Noxa.Emulation.Psp.Player/Debugger/Tools/LogControl.Designer.cs
==============================================================================
---
trunk/Noxa.Emulation.Psp.Player/Debugger/Tools/LogControl.Designer.cs (original)
+++
trunk/Noxa.Emulation.Psp.Player/Debugger/Tools/LogControl.Designer.cs
Sun Mar 23 21:57:45 2008
@@ -28,9 +28,51 @@
/// </summary>
private void InitializeComponent()
{
- components = new System.ComponentModel.Container();
+ this.components = new System.ComponentModel.Container();
+ this.contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(
this.components );
+ this.copyAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
+ this.clearToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.contextMenuStrip.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // contextMenuStrip
+ //
+ this.contextMenuStrip.Items.AddRange( new
System.Windows.Forms.ToolStripItem[] {
+ this.copyAllToolStripMenuItem,
+ this.toolStripSeparator1,
+ this.clearToolStripMenuItem} );
+ this.contextMenuStrip.Name = "contextMenuStrip";
+ this.contextMenuStrip.Size = new System.Drawing.Size( 120, 54 );
+ //
+ // copyAllToolStripMenuItem
+ //
+ this.copyAllToolStripMenuItem.Image = global::Noxa.Emulation.Psp.Player.Properties.Resources.CopyIcon;
+ this.copyAllToolStripMenuItem.Name = "copyAllToolStripMenuItem";
+ this.copyAllToolStripMenuItem.Size = new System.Drawing.Size( 119,
22 );
+ this.copyAllToolStripMenuItem.Text = "Copy &All";
+ //
+ // toolStripSeparator1
+ //
+ this.toolStripSeparator1.Name = "toolStripSeparator1";
+ this.toolStripSeparator1.Size = new System.Drawing.Size( 116, 6 );
+ //
+ // clearToolStripMenuItem
+ //
+ this.clearToolStripMenuItem.Image = global::Noxa.Emulation.Psp.Player.Properties.Resources.ClearIcon;
+ this.clearToolStripMenuItem.Name = "clearToolStripMenuItem";
+ this.clearToolStripMenuItem.Size = new System.Drawing.Size( 119, 22 );
+ this.clearToolStripMenuItem.Text = "&Clear";
+ this.contextMenuStrip.ResumeLayout( false );
+ this.ResumeLayout( false );
+
}

#endregion
+
+ private System.Windows.Forms.ContextMenuStrip contextMenuStrip;
+ private System.Windows.Forms.ToolStripMenuItem copyAllToolStripMenuItem;
+ private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
+ private System.Windows.Forms.ToolStripMenuItem clearToolStripMenuItem;
}
}

Modified: trunk/Noxa.Emulation.Psp.Player/Debugger/Tools/LogControl.cs
==============================================================================
--- trunk/Noxa.Emulation.Psp.Player/Debugger/Tools/LogControl.cs (original)
+++ trunk/Noxa.Emulation.Psp.Player/Debugger/Tools/LogControl.cs Sun
Mar 23 21:57:45 2008
@@ -33,6 +33,8 @@

private VScrollBar _verticalScrollBar;

+ private readonly string[] _featureNames;
+
private List<LogLine> _lines = new List<LogLine>( 20000 );
private int _firstVisibleLine;
private int _lastVisibleLine;
@@ -59,8 +61,41 @@

this.SetupGraphics();
this.CalculateSize( true );
+
+ this.copyAllToolStripMenuItem.Click += new EventHandler(
copyAllToolStripMenuItem_Click );
+ this.clearToolStripMenuItem.Click += new EventHandler(
clearToolStripMenuItem_Click );
+ this.ContextMenuStrip = contextMenuStrip;
+
+ // Build feature list
+ List<string> featureNames = new List<string>();
+ foreach( string feature in Enum.GetNames( typeof( Feature ) ) )
+ featureNames.Add( new string( ' ', 10 - feature.Length ) + feature );
+ _featureNames = featureNames.ToArray();
}

+ #region Context Menu
+
+ private void copyAllToolStripMenuItem_Click( object sender,
EventArgs e )
+ {
+ StringBuilder sb = new StringBuilder();
+ lock( _lines )
+ {
+ foreach( LogLine line in _lines )
+ sb.AppendFormat( "{0}: {1}{2}", _featureNames[ ( int
)line.Feature ], line.Value, Environment.NewLine );
+ }
+ Clipboard.Clear();
+ Clipboard.SetText( sb.ToString() );
+ }
+
+ private void clearToolStripMenuItem_Click( object sender, EventArgs
e )
+ {
+ lock( _lines )
+ _lines.Clear();
+ this.CalculateSize( true );
+ }
+
+ #endregion
+
private int _pendingUpdates;

public void AddLine( Verbosity verbosity, Feature feature, string
value )
@@ -70,11 +105,10 @@
_lines.Add( line );
if( Interlocked.Increment( ref _pendingUpdates ) > 1 )
return;
- this.BeginInvoke( ( SafeAddLineDelegate )this.SafeAddLine, line );
+ this.BeginInvoke( ( DummyDelegate )this.SafeAddLine );
}

- private delegate void SafeAddLineDelegate( LogLine line );
- private void SafeAddLine( LogLine line )
+ private void SafeAddLine()
{
_pendingUpdates = 0;

@@ -99,7 +133,7 @@
private void CalculateSize( bool invalidate )
{
_verticalScrollBar.Minimum = 0;
- _verticalScrollBar.Maximum = _lines.Count + 1;
+ _verticalScrollBar.Maximum = _lines.Count + 1 - _visibleLines;
_visibleLines = ( int )Math.Ceiling( ( double )(
this.ClientRectangle.Height / _lineHeight ) );

if( this.UpdateVisibleLines() == true )
@@ -131,8 +165,8 @@
return false;
_scrollLine = targetLine;
if( _verticalScrollBar.Maximum < _lines.Count )
- _verticalScrollBar.Maximum = _lines.Count;
- _verticalScrollBar.Value = targetLine;
+ _verticalScrollBar.Maximum = _lines.Count + 1 - _visibleLines;
+ _verticalScrollBar.Value = Math.Min( _verticalScrollBar.Maximum,
targetLine );
if( this.UpdateVisibleLines() == true )
{
_verticalScrollBar.Invalidate();
@@ -188,7 +222,7 @@
targetLine -= ( units * ( _visibleLines - 4 ) );
else
targetLine -= ( units * SystemInformation.MouseWheelScrollLines );
- targetLine = Math.Max( Math.Min( targetLine, _lines.Count - 1 ), 0 );
+ targetLine = Math.Max( Math.Min( targetLine, _lines.Count -
_visibleLines ), 0 );

this.ScrollToLine( targetLine );
}
@@ -357,7 +391,7 @@
LogLine line = _lines[ n ];

// Label
- e.Graphics.DrawString( line.Feature.ToString(), _font,
_labelFontBrushes[ ( int )line.Verbosity ], x, y, _stringFormat );
+ e.Graphics.DrawString( _featureNames[ ( int )line.Feature ],
_font, _labelFontBrushes[ ( int )line.Verbosity ], x, y, _stringFormat );

// Value
e.Graphics.DrawString( line.Value, _font, valueBrush, x +
_labelWidth + 4, y, _stringFormat );

Added: trunk/Noxa.Emulation.Psp.Player/Debugger/Tools/LogControl.resx
==============================================================================
--- (empty file)
+++ trunk/Noxa.Emulation.Psp.Player/Debugger/Tools/LogControl.resx Sun
Mar 23 21:57:45 2008
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long
string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array
form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns=""
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string"
minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required"
type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string"
minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string"
minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"
use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string"
msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string"
msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string"
minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"
use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <metadata name="contextMenuStrip.TrayLocation"
type="System.Drawing.Point, System.Drawing, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+ <metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <value>False</value>
+ </metadata>
+</root>
\ No newline at end of file

Modified: trunk/Noxa.Emulation.Psp.Player/Noxa.Emulation.Psp.Player.csproj
==============================================================================
--- trunk/Noxa.Emulation.Psp.Player/Noxa.Emulation.Psp.Player.csproj (original)
+++ trunk/Noxa.Emulation.Psp.Player/Noxa.Emulation.Psp.Player.csproj
Sun Mar 23 21:57:45 2008
@@ -294,6 +294,10 @@
<DependentUpon>DisassemblyControl.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
+ <EmbeddedResource Include="Debugger\Tools\LogControl.resx">
+ <DependentUpon>LogControl.cs</DependentUpon>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
<EmbeddedResource Include="Debugger\Tools\LogTool.resx">
<DependentUpon>LogTool.cs</DependentUpon>
<SubType>Designer</SubType>

Reply all
Reply to author
Forward
0 new messages