← Back to team overview

kicad-developers team mailing list archive

[PATCH] Info panel for DRAWSEGMENTs in the module editor

 

Hi,

I have a small patch here to improve the data presented in the info
panel at the bottom of the page when looking at a DRAWSEGMENT in the
module editor - basically it appends the "normal" pcbnew data to the
module information on the left, and adds a length and angle display.

I am not sure about the angle display - I used an "anti-clockwise from
3-o'clock" convention, rather than a compass-like clockwise from
12-o'clock.

Also, I don't know what each of the colours signifies, so I went with
DARKGREEN.

Thanks,

John
commit 8cd6097275c41afa237f92fc81c6f8c7dbb1a456
Author: John Beard <john.j.beard@xxxxxxxxx>
Date:   Tue Nov 4 23:58:35 2014 +0000

    Improve MsgPanelInfo for line segments in the module editor

diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp
index b680e9b..9f7e71f 100644
--- a/pcbnew/class_drawsegment.cpp
+++ b/pcbnew/class_drawsegment.cpp
@@ -317,7 +317,7 @@ void DRAWSEGMENT::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
 
     wxASSERT( m_Parent );
 
-    msg = wxT( "DRAWING" );
+    msg = _( "Drawing" );
 
     aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg, DARKCYAN ) );
 
@@ -340,7 +340,18 @@ void DRAWSEGMENT::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
         break;
 
     default:
+    {
         aList.push_back( MSG_PANEL_ITEM( shape, _( "Segment" ), RED ) );
+
+        msg = ::CoordinateToString( GetLineLength( m_Start, m_End ) );
+        aList.push_back( MSG_PANEL_ITEM( _( "Length" ), msg, DARKGREEN ) );
+
+        // angle counter-clockwise from 3'o-clock
+        const double deg = RAD2DEG( atan2( m_Start.y - m_End.y,
+                                           m_End.x - m_Start.x ) );
+        msg.Printf( wxT( "%.1f" ), deg );
+        aList.push_back( MSG_PANEL_ITEM( _( "Angle" ), msg, DARKGREEN ) );
+    }
     }
 
     wxString start;
diff --git a/pcbnew/class_edge_mod.cpp b/pcbnew/class_edge_mod.cpp
index 6ade01c..f861798 100644
--- a/pcbnew/class_edge_mod.cpp
+++ b/pcbnew/class_edge_mod.cpp
@@ -280,17 +280,15 @@ void EDGE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
     if( !board )
         return;
 
-    aList.push_back( MSG_PANEL_ITEM( _( "Graphic Item" ), wxEmptyString, DARKCYAN ) );
     aList.push_back( MSG_PANEL_ITEM( _( "Module" ), module->GetReference(), DARKCYAN ) );
     aList.push_back( MSG_PANEL_ITEM( _( "Value" ), module->GetValue(), BLUE ) );
     msg.Printf( wxT( "%8.8lX" ), module->GetTimeStamp() );
     aList.push_back( MSG_PANEL_ITEM( _( "TimeStamp" ), msg, BROWN ) );
     aList.push_back( MSG_PANEL_ITEM( _( "Mod Layer" ),
                      module->GetLayerName(), RED ) );
-    aList.push_back( MSG_PANEL_ITEM( _( "Seg Layer" ),
-                     GetLayerName(), RED ) );
-    msg = ::CoordinateToString( m_Width );
-    aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, BLUE ) );
+
+    // append the features shared with the base class
+    DRAWSEGMENT::GetMsgPanelInfo( aList );
 }
 
 

Follow ups