Some clean-up and moving message panel update to selection event.
This commit is contained in:
parent
2244dcd567
commit
f81007f74b
|
@ -179,7 +179,6 @@ set( EESCHEMA_SRCS
|
|||
netlist_generator.cpp
|
||||
netlist_object_list.cpp
|
||||
netlist_object.cpp
|
||||
onleftclick.cpp
|
||||
onrightclick.cpp
|
||||
operations_on_items_lists.cpp
|
||||
pin_number.cpp
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2004-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2004-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -208,37 +208,6 @@ SCH_BASE_FRAME::COMPONENT_SELECTION SCH_BASE_FRAME::SelectComponentFromLibTree(
|
|||
}
|
||||
|
||||
|
||||
// JEY TODO: obsolete once mover to modern toolset is complete
|
||||
void SCH_EDIT_FRAME::OrientComponent( COMPONENT_ORIENTATION_T aOrientation )
|
||||
{
|
||||
SCH_SCREEN* screen = GetScreen();
|
||||
SCH_ITEM* item = screen->GetCurItem();
|
||||
SCH_COMPONENT* component = (SCH_COMPONENT*) item;
|
||||
|
||||
GetCanvas()->MoveCursorToCrossHair();
|
||||
|
||||
if( item->GetEditFlags() == 0 )
|
||||
SetUndoItem( item );
|
||||
|
||||
component->SetOrientation( aOrientation );
|
||||
|
||||
m_canvas->CrossHairOn( );
|
||||
|
||||
if( item->GetEditFlags() == 0 )
|
||||
{
|
||||
AddItemToScreen( item );
|
||||
SchematicCleanUp();
|
||||
}
|
||||
|
||||
TestDanglingEnds();
|
||||
|
||||
RefreshItem( item );
|
||||
|
||||
if( item->GetEditFlags() == 0 )
|
||||
OnModify();
|
||||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::OnSelectUnit( wxCommandEvent& aEvent )
|
||||
{
|
||||
SCH_SCREEN* screen = GetScreen();
|
||||
|
|
|
@ -1,108 +0,0 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <kiway.h>
|
||||
#include <eeschema_id.h>
|
||||
#include <sch_draw_panel.h>
|
||||
#include <sch_edit_frame.h>
|
||||
#include <sch_component.h>
|
||||
#include <sch_sheet.h>
|
||||
#include <sch_bitmap.h>
|
||||
#include <sch_view.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tools/sch_selection_tool.h>
|
||||
|
||||
/**
|
||||
* Function OnLeftDClick
|
||||
* called on a double click event from the drawpanel mouse handler
|
||||
* if an editable item is found (text, component)
|
||||
* Call the suitable dialog editor.
|
||||
* Id a create command is in progress:
|
||||
* validate and finish the command
|
||||
*/
|
||||
void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
|
||||
// JEY TODO: move to selection tool double-click handling....
|
||||
{
|
||||
SCH_SELECTION_TOOL* selTool = GetToolManager()->GetTool<SCH_SELECTION_TOOL>();
|
||||
EDA_ITEM* item = GetScreen()->GetCurItem();
|
||||
|
||||
switch( GetToolId() )
|
||||
{
|
||||
case ID_NO_TOOL_SELECTED:
|
||||
if( item == NULL || item->GetEditFlags() == 0 )
|
||||
item = selTool->SelectPoint( aPosition, SCH_COLLECTOR::DoubleClickItems );
|
||||
|
||||
if( item == NULL || item->GetEditFlags() != 0 )
|
||||
break;
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case SCH_SHEET_T:
|
||||
g_CurrentSheet->push_back( (SCH_SHEET*) item );
|
||||
DisplayCurrentSheet();
|
||||
break;
|
||||
|
||||
case SCH_COMPONENT_T:
|
||||
EditComponent( (SCH_COMPONENT*) item );
|
||||
GetCanvas()->MoveCursorToCrossHair();
|
||||
|
||||
if( item->GetEditFlags() == 0 )
|
||||
GetScreen()->SetCurItem( nullptr );
|
||||
|
||||
GetCanvas()->Refresh();
|
||||
break;
|
||||
|
||||
case SCH_TEXT_T:
|
||||
case SCH_LABEL_T:
|
||||
case SCH_GLOBAL_LABEL_T:
|
||||
case SCH_HIER_LABEL_T:
|
||||
EditSchematicText( (SCH_TEXT*) item );
|
||||
break;
|
||||
|
||||
case SCH_BITMAP_T:
|
||||
// The bitmap is cached in Opengl: clear the cache, because
|
||||
// the cache data is perhaps invalid
|
||||
if( EditImage( (SCH_BITMAP*) item ) )
|
||||
GetCanvas()->GetView()->RecacheAllItems();
|
||||
|
||||
break;
|
||||
|
||||
case SCH_FIELD_T:
|
||||
EditComponentFieldText( (SCH_FIELD*) item );
|
||||
GetCanvas()->MoveCursorToCrossHair();
|
||||
break;
|
||||
|
||||
case SCH_MARKER_T:
|
||||
( (SCH_MARKER*) item )->DisplayMarkerInfo( this );
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
|
@ -146,19 +146,6 @@ void SCH_BITMAP::Rotate( wxPoint aPosition )
|
|||
}
|
||||
|
||||
|
||||
bool SCH_BITMAP::IsSelectStateChanged( const wxRect& aRect )
|
||||
{
|
||||
bool previousState = IsSelected();
|
||||
|
||||
if( aRect.Contains( m_pos ) )
|
||||
SetFlags( SELECTED );
|
||||
else
|
||||
ClearFlags( SELECTED );
|
||||
|
||||
return previousState != IsSelected();
|
||||
}
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
void SCH_BITMAP::Show( int nestLevel, std::ostream& os ) const
|
||||
{
|
||||
|
@ -167,8 +154,6 @@ void SCH_BITMAP::Show( int nestLevel, std::ostream& os ) const
|
|||
|
||||
NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str() << m_pos << "/>\n";
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -139,13 +139,9 @@ public:
|
|||
bool IsMovableFromAnchorPoint() override { return false; }
|
||||
|
||||
void MirrorY( int aYaxis_position ) override;
|
||||
|
||||
void MirrorX( int aXaxis_position ) override;
|
||||
|
||||
void Rotate( wxPoint aPosition ) override;
|
||||
|
||||
bool IsSelectStateChanged( const wxRect& aRect ) override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override
|
||||
{
|
||||
return wxString( _( "Image" ) );
|
||||
|
@ -154,11 +150,9 @@ public:
|
|||
BITMAP_DEF GetMenuImage() const override;
|
||||
|
||||
wxPoint GetPosition() const override { return m_pos; }
|
||||
|
||||
void SetPosition( const wxPoint& aPosition ) override { m_pos = aPosition; }
|
||||
|
||||
bool HitTest( const wxPoint& aPosition, int aAccuracy ) const override;
|
||||
|
||||
bool HitTest( const EDA_RECT& aRect, bool aContained = false, int aAccuracy = 0 ) const override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter ) override;
|
||||
|
|
|
@ -299,21 +299,6 @@ bool SCH_BUS_ENTRY_BASE::IsDangling() const
|
|||
}
|
||||
|
||||
|
||||
bool SCH_BUS_ENTRY_BASE::IsSelectStateChanged( const wxRect& aRect )
|
||||
{
|
||||
bool previousState = IsSelected();
|
||||
|
||||
// If either end of the bus entry is inside the selection rectangle, the entire
|
||||
// bus entry is selected. Bus entries have a fixed length and angle.
|
||||
if( aRect.Contains( m_pos ) || aRect.Contains( m_End() ) )
|
||||
SetFlags( SELECTED );
|
||||
else
|
||||
ClearFlags( SELECTED );
|
||||
|
||||
return previousState != IsSelected();
|
||||
}
|
||||
|
||||
|
||||
void SCH_BUS_ENTRY_BASE::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const
|
||||
{
|
||||
aPoints.push_back( m_pos );
|
||||
|
|
|
@ -94,17 +94,12 @@ public:
|
|||
m_pos += aMoveVector;
|
||||
}
|
||||
|
||||
|
||||
void MirrorY( int aYaxis_position ) override;
|
||||
|
||||
void MirrorX( int aXaxis_position ) override;
|
||||
|
||||
void Rotate( wxPoint aPosition ) override;
|
||||
|
||||
bool IsDangling() const override;
|
||||
|
||||
bool IsSelectStateChanged( const wxRect& aRect ) override;
|
||||
|
||||
bool IsConnectable() const override { return true; }
|
||||
|
||||
void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const override;
|
||||
|
|
|
@ -1561,21 +1561,6 @@ wxPoint SCH_COMPONENT::GetPinPhysicalPosition( const LIB_PIN* Pin ) const
|
|||
}
|
||||
|
||||
|
||||
bool SCH_COMPONENT::IsSelectStateChanged( const wxRect& aRect )
|
||||
{
|
||||
bool previousState = IsSelected();
|
||||
|
||||
EDA_RECT boundingBox = GetBoundingBox();
|
||||
|
||||
if( aRect.Intersects( boundingBox ) )
|
||||
SetFlags( SELECTED );
|
||||
else
|
||||
ClearFlags( SELECTED );
|
||||
|
||||
return previousState != IsSelected();
|
||||
}
|
||||
|
||||
|
||||
void SCH_COMPONENT::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const
|
||||
{
|
||||
for( const SCH_PIN& pin : m_pins )
|
||||
|
|
|
@ -537,9 +537,7 @@ public:
|
|||
}
|
||||
|
||||
void MirrorY( int aYaxis_position ) override;
|
||||
|
||||
void MirrorX( int aXaxis_position ) override;
|
||||
|
||||
void Rotate( wxPoint aPosition ) override;
|
||||
|
||||
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation ) override;
|
||||
|
@ -561,8 +559,6 @@ public:
|
|||
|
||||
wxPoint GetPinPhysicalPosition( const LIB_PIN* Pin ) const;
|
||||
|
||||
bool IsSelectStateChanged( const wxRect& aRect ) override;
|
||||
|
||||
bool IsConnectable() const override { return true; }
|
||||
|
||||
bool CanConnect( const SCH_ITEM* aItem ) const override
|
||||
|
@ -598,8 +594,7 @@ public:
|
|||
|
||||
BITMAP_DEF GetMenuImage() const override;
|
||||
|
||||
void GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
|
||||
SCH_SHEET_PATH* aSheetPath ) override;
|
||||
void GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems, SCH_SHEET_PATH* aSheetPath ) override;
|
||||
|
||||
bool operator <( const SCH_ITEM& aItem ) const override;
|
||||
|
||||
|
@ -611,11 +606,9 @@ public:
|
|||
bool IsReplaceable() const override { return true; }
|
||||
|
||||
wxPoint GetPosition() const override { return m_Pos; }
|
||||
|
||||
void SetPosition( const wxPoint& aPosition ) override { Move( aPosition - m_Pos ); }
|
||||
|
||||
bool HitTest( const wxPoint& aPosition, int aAccuracy ) const override;
|
||||
|
||||
bool HitTest( const EDA_RECT& aRect, bool aContained = false, int aAccuracy = 0 ) const override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter ) override;
|
||||
|
|
|
@ -371,7 +371,6 @@ public:
|
|||
|
||||
void KiwayMailIn( KIWAY_EXPRESS& aEvent ) override;
|
||||
|
||||
void OnLeftDClick( wxDC* aDC, const wxPoint& aPosition ) override;
|
||||
bool OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) override;
|
||||
void OnSelectOptionToolbar( wxCommandEvent& event );
|
||||
double BestZoom() override;
|
||||
|
@ -1031,11 +1030,6 @@ public:
|
|||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Rotate and mirror a component.
|
||||
*/
|
||||
void OrientComponent( COMPONENT_ORIENTATION_T aOrientation = CMP_NORMAL );
|
||||
|
||||
/**
|
||||
* Display the edit field dialog to edit the parameters of \a aField.
|
||||
*
|
||||
|
|
|
@ -289,18 +289,6 @@ public:
|
|||
|
||||
virtual bool CanConnect( const SCH_ITEM* aItem ) const { return m_Layer == aItem->GetLayer(); }
|
||||
|
||||
/**
|
||||
* Function IsSelectStateChanged
|
||||
* checks if the selection state of an item inside \a aRect has changed.
|
||||
*
|
||||
* This is used by the block selection code to verify if an item is selected or not.
|
||||
* True is be return anytime the select state changes. If you need to know the
|
||||
* the current selection state, use the IsSelected() method.
|
||||
*
|
||||
* @param aRect - Rectangle to test against.
|
||||
*/
|
||||
virtual bool IsSelectStateChanged( const wxRect& aRect ) { return false; }
|
||||
|
||||
/**
|
||||
* Function IsConnectable
|
||||
* returns true if the schematic item can connect to another schematic item.
|
||||
|
|
|
@ -126,19 +126,6 @@ void SCH_JUNCTION::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
|
|||
}
|
||||
|
||||
|
||||
bool SCH_JUNCTION::IsSelectStateChanged( const wxRect& aRect )
|
||||
{
|
||||
bool previousState = IsSelected();
|
||||
|
||||
if( aRect.Contains( m_pos ) )
|
||||
SetFlags( SELECTED );
|
||||
else
|
||||
ClearFlags( SELECTED );
|
||||
|
||||
return previousState != IsSelected();
|
||||
}
|
||||
|
||||
|
||||
void SCH_JUNCTION::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const
|
||||
{
|
||||
aPoints.push_back( m_pos );
|
||||
|
|
|
@ -22,10 +22,6 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file sch_junction.h
|
||||
*/
|
||||
|
||||
#ifndef _SCH_JUNCTION_H_
|
||||
#define _SCH_JUNCTION_H_
|
||||
|
||||
|
@ -71,15 +67,11 @@ public:
|
|||
}
|
||||
|
||||
void MirrorY( int aYaxis_position ) override;
|
||||
|
||||
void MirrorX( int aXaxis_position ) override;
|
||||
|
||||
void Rotate( wxPoint aPosition ) override;
|
||||
|
||||
void GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList ) override;
|
||||
|
||||
bool IsSelectStateChanged( const wxRect& aRect ) override;
|
||||
|
||||
bool IsConnectable() const override { return true; }
|
||||
|
||||
void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const override;
|
||||
|
@ -101,13 +93,11 @@ public:
|
|||
void GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems, SCH_SHEET_PATH* aSheetPath ) override;
|
||||
|
||||
wxPoint GetPosition() const override { return m_pos; }
|
||||
|
||||
void SetPosition( const wxPoint& aPosition ) override { m_pos = aPosition; }
|
||||
|
||||
bool HitTest( const wxPoint& aPosition, int aAccuracy ) const override;
|
||||
bool HitTest( const EDA_RECT& aRect, bool aContained = false, int aAccuracy = 0 ) const override;
|
||||
|
||||
bool HitTest( const EDA_RECT& aRect, bool aContained = false,
|
||||
int aAccuracy = 0 ) const override;
|
||||
void Plot( PLOTTER* aPlotter ) override;
|
||||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
|
|
@ -22,11 +22,6 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file sch_marker.cpp
|
||||
* @brief Class SCH_MARKER implementation
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <sch_draw_panel.h>
|
||||
#include <trigo.h>
|
||||
|
@ -59,6 +54,12 @@ EDA_ITEM* SCH_MARKER::Clone() const
|
|||
}
|
||||
|
||||
|
||||
void SCH_MARKER::SwapData( SCH_ITEM* aItem )
|
||||
{
|
||||
std::swap( *((SCH_MARKER*) this), *((SCH_MARKER*) aItem ) );
|
||||
}
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
|
||||
void SCH_MARKER::Show( int nestLevel, std::ostream& os ) const
|
||||
|
@ -151,19 +152,6 @@ void SCH_MARKER::MirrorY( int aYaxis_position )
|
|||
}
|
||||
|
||||
|
||||
bool SCH_MARKER::IsSelectStateChanged( const wxRect& aRect )
|
||||
{
|
||||
bool previousState = IsSelected();
|
||||
|
||||
if( aRect.Contains( m_Pos ) )
|
||||
SetFlags( SELECTED );
|
||||
else
|
||||
ClearFlags( SELECTED );
|
||||
|
||||
return previousState != IsSelected();
|
||||
}
|
||||
|
||||
|
||||
bool SCH_MARKER::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
||||
{
|
||||
return HitTestMarker( aPosition );
|
||||
|
|
|
@ -22,11 +22,6 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file sch_marker.h
|
||||
* @brief SCH_MARKER class definition.
|
||||
*/
|
||||
|
||||
#ifndef TYPE_SCH_MARKER_H_
|
||||
#define TYPE_SCH_MARKER_H_
|
||||
|
||||
|
@ -48,6 +43,8 @@ public:
|
|||
return wxT( "SCH_MARKER" );
|
||||
}
|
||||
|
||||
void SwapData( SCH_ITEM* aItem ) override;
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
|
||||
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset ) override;
|
||||
|
@ -69,11 +66,8 @@ public:
|
|||
m_Pos += aMoveVector;
|
||||
}
|
||||
|
||||
|
||||
void MirrorY( int aYaxis_position ) override;
|
||||
|
||||
void MirrorX( int aXaxis_position ) override;
|
||||
|
||||
void Rotate( wxPoint aPosition ) override;
|
||||
|
||||
/**
|
||||
|
@ -89,8 +83,6 @@ public:
|
|||
|
||||
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
|
||||
|
||||
bool IsSelectStateChanged( const wxRect& aRect ) override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override
|
||||
{
|
||||
return wxString( _( "ERC Marker" ) );
|
||||
|
@ -99,7 +91,6 @@ public:
|
|||
BITMAP_DEF GetMenuImage() const override;
|
||||
|
||||
wxPoint GetPosition() const override { return m_Pos; }
|
||||
|
||||
void SetPosition( const wxPoint& aPosition ) override { m_Pos = aPosition; }
|
||||
|
||||
bool HitTest( const wxPoint& aPosition, int aAccuracy ) const override;
|
||||
|
|
|
@ -133,19 +133,6 @@ void SCH_NO_CONNECT::Rotate( wxPoint aPosition )
|
|||
}
|
||||
|
||||
|
||||
bool SCH_NO_CONNECT::IsSelectStateChanged( const wxRect& aRect )
|
||||
{
|
||||
bool previousState = IsSelected();
|
||||
|
||||
if( aRect.Contains( m_pos ) )
|
||||
SetFlags( SELECTED );
|
||||
else
|
||||
ClearFlags( SELECTED );
|
||||
|
||||
return previousState != IsSelected();
|
||||
}
|
||||
|
||||
|
||||
void SCH_NO_CONNECT::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const
|
||||
{
|
||||
aPoints.push_back( m_pos );
|
||||
|
|
|
@ -76,13 +76,9 @@ public:
|
|||
}
|
||||
|
||||
void MirrorY( int aYaxis_position ) override;
|
||||
|
||||
void MirrorX( int aXaxis_position ) override;
|
||||
|
||||
void Rotate( wxPoint aPosition ) override;
|
||||
|
||||
bool IsSelectStateChanged( const wxRect& aRect ) override;
|
||||
|
||||
bool IsConnectable() const override { return true; }
|
||||
|
||||
bool CanConnect( const SCH_ITEM* aItem ) const override
|
||||
|
@ -103,11 +99,9 @@ public:
|
|||
void GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems, SCH_SHEET_PATH* aSheetPath ) override;
|
||||
|
||||
wxPoint GetPosition() const override { return m_pos; }
|
||||
|
||||
void SetPosition( const wxPoint& aPosition ) override { m_pos = aPosition; }
|
||||
|
||||
bool HitTest( const wxPoint& aPosition, int aAccuracy ) const override;
|
||||
|
||||
bool HitTest( const EDA_RECT& aRect, bool aContained = false, int aAccuracy = 0 ) const override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter ) override;
|
||||
|
|
|
@ -783,21 +783,6 @@ bool SCH_SHEET::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList )
|
|||
}
|
||||
|
||||
|
||||
bool SCH_SHEET::IsSelectStateChanged( const wxRect& aRect )
|
||||
{
|
||||
bool previousState = IsSelected();
|
||||
|
||||
EDA_RECT boundingBox = GetBoundingBox();
|
||||
|
||||
if( aRect.Intersects( boundingBox ) )
|
||||
SetFlags( SELECTED );
|
||||
else
|
||||
ClearFlags( SELECTED );
|
||||
|
||||
return previousState != IsSelected();
|
||||
}
|
||||
|
||||
|
||||
void SCH_SHEET::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const
|
||||
{
|
||||
for( size_t i = 0; i < GetPins().size(); i++ )
|
||||
|
|
|
@ -22,11 +22,6 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file sch_sheet.h
|
||||
* @brief Definition of the SCH_SHEET class for Eeschema.
|
||||
*/
|
||||
|
||||
#ifndef SCH_SHEEET_H
|
||||
#define SCH_SHEEET_H
|
||||
|
||||
|
@ -168,11 +163,9 @@ public:
|
|||
Offset( aMoveVector );
|
||||
}
|
||||
|
||||
void MirrorY( int aYaxis_position ) override;
|
||||
|
||||
void Rotate( wxPoint aPosition ) override;
|
||||
|
||||
void MirrorX( int aXaxis_position ) override;
|
||||
void MirrorY( int aYaxis_position ) override;
|
||||
void Rotate( wxPoint aPosition ) override;
|
||||
|
||||
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation ) override;
|
||||
|
||||
|
@ -264,21 +257,17 @@ public:
|
|||
bool IsMovableFromAnchorPoint() override { return false; }
|
||||
|
||||
wxString GetName() const { return m_name; }
|
||||
|
||||
void SetName( const wxString& aName ) { m_name = aName; }
|
||||
|
||||
int GetSheetNameSize() const { return m_sheetNameSize; }
|
||||
|
||||
void SetSheetNameSize( int aSize ) { m_sheetNameSize = aSize; }
|
||||
|
||||
int GetFileNameSize() const { return m_fileNameSize; }
|
||||
|
||||
void SetFileNameSize( int aSize ) { m_fileNameSize = aSize; }
|
||||
|
||||
SCH_SCREEN* GetScreen() { return m_screen; }
|
||||
|
||||
wxSize GetSize() { return m_size; }
|
||||
|
||||
void SetSize( const wxSize& aSize ) { m_size = aSize; }
|
||||
|
||||
/**
|
||||
|
@ -484,9 +473,7 @@ public:
|
|||
}
|
||||
|
||||
void MirrorY( int aYaxis_position ) override;
|
||||
|
||||
void MirrorX( int aXaxis_position ) override;
|
||||
|
||||
void Rotate( wxPoint aPosition ) override;
|
||||
|
||||
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation ) override;
|
||||
|
@ -516,8 +503,6 @@ public:
|
|||
|
||||
bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList ) override;
|
||||
|
||||
bool IsSelectStateChanged( const wxRect& aRect ) override;
|
||||
|
||||
bool IsConnectable() const override { return true; }
|
||||
|
||||
bool CanConnect( const SCH_ITEM* aItem ) const override
|
||||
|
@ -543,11 +528,9 @@ public:
|
|||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
|
||||
wxPoint GetPosition() const override { return m_pos; }
|
||||
|
||||
void SetPosition( const wxPoint& aPosition ) override;
|
||||
|
||||
bool HitTest( const wxPoint& aPosition, int aAccuracy ) const override;
|
||||
|
||||
bool HitTest( const EDA_RECT& aRect, bool aContained = false, int aAccuracy = 0 ) const override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter ) override;
|
||||
|
|
|
@ -421,19 +421,6 @@ bool SCH_TEXT::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList )
|
|||
}
|
||||
|
||||
|
||||
bool SCH_TEXT::IsSelectStateChanged( const wxRect& aRect )
|
||||
{
|
||||
bool previousState = IsSelected();
|
||||
|
||||
if( aRect.Contains( GetTextPos() ) )
|
||||
SetFlags( SELECTED );
|
||||
else
|
||||
ClearFlags( SELECTED );
|
||||
|
||||
return previousState != IsSelected();
|
||||
}
|
||||
|
||||
|
||||
void SCH_TEXT::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const
|
||||
{
|
||||
// Normal text labels do not have connection points. All others do.
|
||||
|
|
|
@ -130,7 +130,7 @@ public:
|
|||
*/
|
||||
virtual wxPoint GetSchematicTextOffset() const;
|
||||
|
||||
virtual void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset ) override;
|
||||
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset ) override;
|
||||
|
||||
/**
|
||||
* Calculate the graphic shape (a polygon) associated to the text.
|
||||
|
@ -144,66 +144,58 @@ public:
|
|||
aPoints.clear();
|
||||
}
|
||||
|
||||
virtual void SwapData( SCH_ITEM* aItem ) override;
|
||||
void SwapData( SCH_ITEM* aItem ) override;
|
||||
|
||||
virtual const EDA_RECT GetBoundingBox() const override;
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
|
||||
virtual int GetPenSize() const override;
|
||||
int GetPenSize() const override;
|
||||
|
||||
// Geometric transforms (used in block operations):
|
||||
|
||||
virtual void Move( const wxPoint& aMoveVector ) override
|
||||
void Move( const wxPoint& aMoveVector ) override
|
||||
{
|
||||
EDA_TEXT::Offset( aMoveVector );
|
||||
}
|
||||
|
||||
virtual void MirrorY( int aYaxis_position ) override;
|
||||
void MirrorY( int aYaxis_position ) override;
|
||||
void MirrorX( int aXaxis_position ) override;
|
||||
void Rotate( wxPoint aPosition ) override;
|
||||
|
||||
virtual void MirrorX( int aXaxis_position ) override;
|
||||
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation ) override;
|
||||
|
||||
virtual void Rotate( wxPoint aPosition ) override;
|
||||
|
||||
virtual bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation ) override;
|
||||
|
||||
virtual bool Replace( wxFindReplaceData& aSearchData, void* aAuxData ) override
|
||||
bool Replace( wxFindReplaceData& aSearchData, void* aAuxData ) override
|
||||
{
|
||||
return EDA_ITEM::Replace( aSearchData, m_Text );
|
||||
}
|
||||
|
||||
virtual bool IsReplaceable() const override { return true; }
|
||||
|
||||
virtual void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override;
|
||||
void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override;
|
||||
|
||||
virtual bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList ) override;
|
||||
bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList ) override;
|
||||
|
||||
virtual bool IsDangling() const override { return m_isDangling; }
|
||||
bool IsDangling() const override { return m_isDangling; }
|
||||
void SetIsDangling( bool aIsDangling ) { m_isDangling = aIsDangling; }
|
||||
|
||||
virtual void SetIsDangling( bool aIsDangling ) { m_isDangling = aIsDangling; }
|
||||
void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const override;
|
||||
|
||||
virtual bool IsSelectStateChanged( const wxRect& aRect ) override;
|
||||
bool CanIncrementLabel() const override { return true; }
|
||||
|
||||
virtual void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const override;
|
||||
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
|
||||
|
||||
virtual bool CanIncrementLabel() const override { return true; }
|
||||
BITMAP_DEF GetMenuImage() const override;
|
||||
|
||||
virtual wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
|
||||
void GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems, SCH_SHEET_PATH* aSheetPath ) override;
|
||||
|
||||
virtual BITMAP_DEF GetMenuImage() const override;
|
||||
wxPoint GetPosition() const override { return EDA_TEXT::GetTextPos(); }
|
||||
void SetPosition( const wxPoint& aPosition ) override { EDA_TEXT::SetTextPos( aPosition ); }
|
||||
|
||||
virtual void GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
|
||||
SCH_SHEET_PATH* aSheetPath ) override;
|
||||
bool HitTest( const wxPoint& aPosition, int aAccuracy ) const override;
|
||||
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const override;
|
||||
|
||||
virtual wxPoint GetPosition() const override { return EDA_TEXT::GetTextPos(); }
|
||||
void Plot( PLOTTER* aPlotter ) override;
|
||||
|
||||
virtual void SetPosition( const wxPoint& aPosition ) override { EDA_TEXT::SetTextPos( aPosition ); }
|
||||
|
||||
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const override;
|
||||
|
||||
virtual bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const override;
|
||||
|
||||
virtual void Plot( PLOTTER* aPlotter ) override;
|
||||
|
||||
virtual EDA_ITEM* Clone() const override;
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
||||
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;
|
||||
|
||||
|
|
|
@ -419,10 +419,6 @@ int SCH_DRAWING_TOOL::doPlaceComponent( SCH_COMPONENT* aComponent, SCHLIB_FILTER
|
|||
field->SetText( i.second );
|
||||
}
|
||||
|
||||
MSG_PANEL_ITEMS items;
|
||||
aComponent->GetMsgPanelInfo( m_frame->GetUserUnits(), items );
|
||||
m_frame->SetMsgPanel( items );
|
||||
|
||||
if( m_frame->GetAutoplaceFields() )
|
||||
aComponent->AutoplaceFields( /* aScreen */ NULL, /* aManual */ false );
|
||||
|
||||
|
@ -549,16 +545,14 @@ int SCH_DRAWING_TOOL::PlaceImage( const TOOL_EVENT& aEvent )
|
|||
continue;
|
||||
}
|
||||
|
||||
MSG_PANEL_ITEMS items;
|
||||
image->GetMsgPanelInfo( m_frame->GetUserUnits(), items );
|
||||
m_frame->SetMsgPanel( items );
|
||||
|
||||
image->SetFlags( IS_MOVED );
|
||||
m_frame->SetRepeatItem( image );
|
||||
m_frame->GetScreen()->SetCurItem( image );
|
||||
m_view->ClearPreview();
|
||||
m_view->AddToPreview( image->Clone() );
|
||||
|
||||
m_toolMgr->RunAction( SCH_ACTIONS::selectItem, true, aComponent );
|
||||
|
||||
m_controls->SetCursorPosition( cursorPos, false );
|
||||
}
|
||||
else
|
||||
|
@ -814,11 +808,6 @@ int SCH_DRAWING_TOOL::doTwoClickPlace( KICAD_T aType )
|
|||
{
|
||||
m_toolMgr->RunAction( SCH_ACTIONS::selectItem, true, item );
|
||||
|
||||
// JEY TODO: this should be handled by selection event....
|
||||
MSG_PANEL_ITEMS items;
|
||||
item->GetMsgPanelInfo( m_frame->GetUserUnits(), items );
|
||||
m_frame->SetMsgPanel( items );
|
||||
|
||||
item->SetFlags( IS_MOVED );
|
||||
m_view->ClearPreview();
|
||||
m_view->AddToPreview( item->Clone() );
|
||||
|
|
|
@ -628,6 +628,28 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
int SCH_EDITOR_CONTROL::UpdateMessagePanel( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
|
||||
SELECTION& selection = selTool->GetSelection();
|
||||
|
||||
if( selection.GetSize() == 1 )
|
||||
{
|
||||
SCH_ITEM* item = (SCH_ITEM*) selection.GetItem( 0 );
|
||||
|
||||
MSG_PANEL_ITEMS msgItems;
|
||||
item->GetMsgPanelInfo( m_frame->GetUserUnits(), msgItems );
|
||||
m_frame->SetMsgPanel( msgItems );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_frame->ClearMsgPanel();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void SCH_EDITOR_CONTROL::setTransitions()
|
||||
{
|
||||
/*
|
||||
|
@ -643,6 +665,10 @@ void SCH_EDITOR_CONTROL::setTransitions()
|
|||
Go( &SCH_EDITOR_CONTROL::CrossProbePcbToSch, SCH_ACTIONS::crossProbeSchToPcb.MakeEvent() );
|
||||
*/
|
||||
|
||||
Go( &SCH_EDITOR_CONTROL::UpdateMessagePanel, EVENTS::SelectedEvent );
|
||||
Go( &SCH_EDITOR_CONTROL::UpdateMessagePanel, EVENTS::UnselectedEvent );
|
||||
Go( &SCH_EDITOR_CONTROL::UpdateMessagePanel, EVENTS::ClearedEvent );
|
||||
|
||||
#ifdef KICAD_SPICE
|
||||
Go( &SCH_EDITOR_CONTROL::SimProbe, SCH_ACTIONS::simProbe.MakeEvent() );
|
||||
Go( &SCH_EDITOR_CONTROL::SimTune, SCH_ACTIONS::simTune.MakeEvent() );
|
||||
|
|
|
@ -59,6 +59,8 @@ public:
|
|||
///> Notifies pcbnew about the selected item.
|
||||
int CrossProbeSchToPcb( const TOOL_EVENT& aEvent );
|
||||
|
||||
int UpdateMessagePanel( const TOOL_EVENT& aEvent );
|
||||
|
||||
#ifdef KICAD_SPICE
|
||||
int SimProbe( const TOOL_EVENT& aEvent );
|
||||
int SimTune( const TOOL_EVENT& aEvent );
|
||||
|
|
|
@ -271,17 +271,11 @@ SCH_ITEM* SCH_SELECTION_TOOL::SelectPoint( const VECTOR2I& aWhere, const KICAD_T
|
|||
}
|
||||
}
|
||||
|
||||
// JEY TODO: move to own action triggered by selection event....
|
||||
if( collector.GetCount() == 1 )
|
||||
{
|
||||
SCH_ITEM* item = collector[ 0 ];
|
||||
|
||||
toggleSelection( item );
|
||||
|
||||
MSG_PANEL_ITEMS msgItems;
|
||||
item->GetMsgPanelInfo( m_frame->GetUserUnits(), msgItems );
|
||||
m_frame->SetMsgPanel( msgItems );
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ enum main_id
|
|||
ID_POPUP_CANCEL_CURRENT_COMMAND,
|
||||
ID_POPUP_CLOSE_CURRENT_TOOL,
|
||||
|
||||
// JEY TODO: all the block-specific commands are obsolet after LibEdit moves to modern toolset
|
||||
// JEY TODO: all the block-specific commands are obsolete after LibEdit moves to modern toolset
|
||||
ID_POPUP_MOVE_BLOCK,
|
||||
ID_POPUP_MOVE_BLOCK_EXACT,
|
||||
ID_POPUP_DRAG_BLOCK,
|
||||
|
|
|
@ -974,12 +974,10 @@ static bool highlightNet( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition,
|
|||
GENERAL_COLLECTOR collector;
|
||||
|
||||
// Find a connected item for which we are going to highlight a net
|
||||
collector.Collect( board, GENERAL_COLLECTOR::PadsOrTracks,
|
||||
wxPoint( aPosition.x, aPosition.y ), guide );
|
||||
collector.Collect( board, GENERAL_COLLECTOR::PadsOrTracks, (wxPoint) aPosition, guide );
|
||||
|
||||
if( collector.GetCount() == 0 )
|
||||
collector.Collect( board, GENERAL_COLLECTOR::Zones,
|
||||
wxPoint( aPosition.x, aPosition.y ), guide );
|
||||
collector.Collect( board, GENERAL_COLLECTOR::Zones, (wxPoint) aPosition, guide );
|
||||
|
||||
// Clear the previous highlight
|
||||
frame->SendMessageToEESCHEMA( nullptr );
|
||||
|
|
Loading…
Reference in New Issue