Commit 1dd0adf7 authored by jean-pierre charras's avatar jean-pierre charras

Eeschema: item drag command: Fix issue for overlapping items (from a Younes Manton's idea)

Added: display info when clicking on labels.
parent b5302db7
...@@ -186,12 +186,24 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -186,12 +186,24 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
m_canvas->Refresh(); m_canvas->Refresh();
} }
/*
* HandleBlockEnd is called when:
* a block is defined
* or a schematic iten should be dragged
* When the block is defined, all items inside the block should be collected
* When a schematic iten should be dragged, only this item should be collected
*
* In all cases, connected items are collected when a drag command is activated
*/
bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
{ {
bool nextcmd = false; bool nextcmd = false;
bool zoom_command = false; bool zoom_command = false;
BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate; BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
bool currItemOnly = false;
if ( block->GetCommand() == BLOCK_DRAG && GetScreen()->GetCurItem() != NULL )
currItemOnly = true;
if( block->GetCount() ) if( block->GetCount() )
{ {
...@@ -242,6 +254,13 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -242,6 +254,13 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
case BLOCK_MOVE: case BLOCK_MOVE:
case BLOCK_COPY: case BLOCK_COPY:
if( currItemOnly )
{
ITEM_PICKER picker;
picker.SetItem( GetScreen()->GetCurItem() );
block->PushItem( picker );
}
else
GetScreen()->UpdatePickList(); GetScreen()->UpdatePickList();
// fall through // fall through
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <drawtxt.h> #include <drawtxt.h>
#include <wxEeschemaStruct.h> #include <wxEeschemaStruct.h>
#include <plot_common.h> #include <plot_common.h>
#include <base_units.h>
#include <general.h> #include <general.h>
#include <protos.h> #include <protos.h>
...@@ -729,6 +730,101 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter ) ...@@ -729,6 +730,101 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter )
aPlotter->PlotPoly( Poly, NO_FILL ); aPlotter->PlotPoly( Poly, NO_FILL );
} }
/*
* Display the type, shape, size and some other props to the Message panel
*/
void SCH_TEXT::DisplayInfo( EDA_DRAW_FRAME* frame )
{
wxString msg;
frame->ClearMsgPanel();
switch( Type() )
{
case SCH_TEXT_T:
msg = _("Graphic text");
break;
case SCH_LABEL_T:
msg = _("Label");
break;
case SCH_GLOBAL_LABEL_T:
msg = _("Global label");
break;
case SCH_HIERARCHICAL_LABEL_T:
msg = _("Hierarchical label");
break;
case SCH_SHEET_PIN_T:
msg = _( "Hierarchical Sheet Pin" );
break;
default:
return;
}
frame->AppendMsgPanel( msg, wxEmptyString, DARKCYAN );
switch( GetOrientation() )
{
case 0: // horizontal text
msg = _("Horizontal");
break;
case 1: // Vert Orientation UP
msg = _("Vertical up");
break;
case 2: // invert horizontal text
msg = _("Horizontal invert");
break;
case 3: // Vert Orientation Down
msg = _("Vertical down");;
break;
default:
msg = wxT("???");
break;
}
frame->AppendMsgPanel( _("Orientation"), msg, BROWN );
wxString textStyle[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") };
int style = 0;
if( m_Italic )
style = 1;
if( m_Bold )
style += 2;
frame->AppendMsgPanel( _("Style"), textStyle[style], BROWN );
// Display electricat type if it is relevant
if( (Type() == SCH_GLOBAL_LABEL_T) ||
(Type() == SCH_HIERARCHICAL_LABEL_T ) ||
(Type() == SCH_SHEET_PIN_T ) )
{
switch( GetShape() )
{
case NET_INPUT: msg = _("Input"); break;
case NET_OUTPUT: msg = _("Output"); break;
case NET_BIDI: msg = _("Bidirectional"); break;
case NET_TRISTATE: msg = _("Tri-State"); break;
case NET_UNSPECIFIED: msg = _("Passive"); break;
default: msg = wxT("???"); break;
}
frame->AppendMsgPanel( _("Type"), msg, BLUE );
}
// Display text size (X or Y value, with are the same value in Eeschema)
msg = ReturnStringFromValue( g_UserUnit, m_Size.x, true );
frame->AppendMsgPanel( _("Size"), msg, RED );
}
#if defined(DEBUG) #if defined(DEBUG)
......
...@@ -212,6 +212,8 @@ public: ...@@ -212,6 +212,8 @@ public:
virtual EDA_ITEM* Clone() const; virtual EDA_ITEM* Clone() const;
void DisplayInfo( EDA_DRAW_FRAME* frame ); // Virtual function
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // override void Show( int nestLevel, std::ostream& os ) const; // override
#endif #endif
......
...@@ -913,6 +913,7 @@ void SCH_EDIT_FRAME::OnDragItem( wxCommandEvent& aEvent ) ...@@ -913,6 +913,7 @@ void SCH_EDIT_FRAME::OnDragItem( wxCommandEvent& aEvent )
// Fall thru if item is not on bus layer. // Fall thru if item is not on bus layer.
case SCH_COMPONENT_T: case SCH_COMPONENT_T:
case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T: case SCH_GLOBAL_LABEL_T:
case SCH_HIERARCHICAL_LABEL_T: case SCH_HIERARCHICAL_LABEL_T:
case SCH_SHEET_T: case SCH_SHEET_T:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment