7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-20 14:01:41 +00:00

eeschema-gal: initial GALified version. Lots of stuff still to do!

This commit is contained in:
Tomasz Wlostowski 2018-08-03 14:18:26 +02:00 committed by Jeff Young
parent 14fed877c8
commit 90c7c60471
101 changed files with 3361 additions and 808 deletions
eeschema
CMakeLists.txtannotate.cppautoplace_fields.cppblock.cppbus-wire-junction.cppbusentry.cppclass_libentry.cppclass_libentry.hcontrole.cppcross-probing.cppdialog_erc_listbox.h
dialogs
edit_bitmap.cppedit_component_in_schematic.cppedit_label.cppeeredraw.cppeeschema_config.cpperc.cppevents_called_functions_for_edit.cppfiles-io.cppfind.cppgetpart.cpphierarch.cpphighlight_connection.cpphotkeys.cpplib_arc.cpplib_arc.hlib_bezier.cpplib_bezier.hlib_circle.cpplib_circle.hlib_draw_item.cpplib_draw_item.hlib_field.cpplib_field.hlib_pin.cpplib_pin.hlib_polyline.cpplib_polyline.hlib_rectangle.cpplib_rectangle.hlib_text.cpplib_text.h
libedit
onleftclick.cpponrightclick.cppoperations_on_items_lists.cppplot_schematic_SVG.cppproject_rescue.cppsch_base_frame.cppsch_base_frame.hsch_bitmap.cppsch_bus_entry.cppsch_bus_entry.hsch_component.cppsch_draw_panel.cppsch_draw_panel.hsch_edit_frame.cppsch_edit_frame.hsch_field.cppsch_item_struct.cppsch_item_struct.hsch_junction.cppsch_line.cppsch_marker.cppsch_no_connect.cppsch_no_connect.hsch_painter.cppsch_painter.hsch_screen.cppsch_screen.hsch_sheet.cppsch_sheet_pin.cppsch_text.cppsch_view.cppsch_view.hschedit.cppschematic_undo_redo.cppsheet.cppsheetlab.cpptool_sch.cppviewlib_frame.cppviewlibs.cpp
widgets

View File

@ -11,9 +11,12 @@ endif()
include_directories( BEFORE ${INC_BEFORE} )
include_directories(
../include/legacy_gal
./dialogs
./netlist_exporters
./widgets
./libedit
./libview
../common
../common/dialogs
${INC_AFTER}
@ -92,14 +95,35 @@ set( EESCHEMA_WIDGETS
)
set ( EESCHEMA_LIBEDIT_SRCS
libedit/block_libedit.cpp
libedit/controller.cpp
libedit/libedit.cpp
libedit/libedit_onleftclick.cpp
libedit/libedit_onrightclick.cpp
libedit/libedit_plot_component.cpp
libedit/libedit_undo_redo.cpp
libedit/lib_edit_frame.cpp
libedit/libfield.cpp
libedit/menubar_libedit.cpp
libedit/pinedit.cpp
libedit/symbdraw.cpp
libedit/symbedit.cpp
libedit/tool_lib.cpp
libedit/lib_export.cpp
libedit/lib_manager.cpp
)
set( EESCHEMA_SRCS
${EESCHEMA_DLGS}
${EESCHEMA_WIDGETS}
${EESCHEMA_LIBEDIT_SRCS}
sch_view.cpp
sch_painter.cpp
annotate.cpp
autoplace_fields.cpp
backanno.cpp
block.cpp
block_libedit.cpp
bus-wire-junction.cpp
busentry.cpp
class_libentry.cpp
@ -131,23 +155,13 @@ set( EESCHEMA_SRCS
lib_circle.cpp
lib_collectors.cpp
lib_draw_item.cpp
lib_export.cpp
lib_field.cpp
lib_manager.cpp
lib_pin.cpp
lib_polyline.cpp
lib_rectangle.cpp
lib_text.cpp
libarch.cpp
libedit.cpp
libedit_onleftclick.cpp
libedit_onrightclick.cpp
libedit_plot_component.cpp
libedit_undo_redo.cpp
lib_edit_frame.cpp
libfield.cpp
menubar.cpp
menubar_libedit.cpp
netlist_generator.cpp
netlist_object_list.cpp
netlist_object.cpp
@ -157,12 +171,12 @@ set( EESCHEMA_SRCS
pin_number.cpp
pin_shape.cpp
pin_type.cpp
pinedit.cpp
plot_schematic_DXF.cpp
plot_schematic_HPGL.cpp
plot_schematic_PDF.cpp
plot_schematic_PS.cpp
plot_schematic_SVG.cpp
sch_draw_panel.cpp
project_rescue.cpp
sch_base_frame.cpp
sch_bitmap.cpp
@ -191,14 +205,11 @@ set( EESCHEMA_SRCS
selpart.cpp
sheet.cpp
sheetlab.cpp
symbdraw.cpp
symbedit.cpp
symbol_lib_table.cpp
symbol_tree_model_adapter.cpp
symbol_tree_synchronizing_adapter.cpp
template_fieldnames.cpp
template_fieldnames_keywords.cpp
tool_lib.cpp
tool_sch.cpp
tool_viewlib.cpp
transform.cpp
@ -299,6 +310,19 @@ target_link_libraries( eeschema
common
bitmaps
gal
legacy_gal
common
bitmaps
gal
legacy_gal
common
bitmaps
gal
legacy_gal
common
bitmaps
gal
legacy_gal
${wxWidgets_LIBRARIES}
)
@ -312,6 +336,22 @@ target_link_libraries( eeschema_kiface
bitmaps
polygon
gal
legacy_gal
common
bitmaps
polygon
gal
legacy_gal
common
bitmaps
polygon
gal
legacy_gal
common
bitmaps
polygon
gal
legacy_gal
${wxWidgets_LIBRARIES}
${GDI_PLUS_LIBRARIES}
)

View File

@ -29,7 +29,7 @@
#include <algorithm>
#include <fctsys.h>
#include <class_drawpanel.h>
#include <sch_draw_panel.h>
#include <confirm.h>
#include <reporter.h>
#include <sch_edit_frame.h>
@ -236,7 +236,7 @@ void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic,
m_CurrentSheet->UpdateAllScreenReferences();
SetSheetNumberAndCount();
m_canvas->Refresh( true );
SyncView();
}

View File

@ -57,7 +57,7 @@
#include <sch_component.h>
#include <sch_line.h>
#include <lib_pin.h>
#include <class_drawpanel.h>
#include <sch_draw_panel.h>
#include <class_libentry.h>
#include <eeschema_config.h>
#include <kiface_i.h>

View File

@ -30,7 +30,7 @@
#include <fctsys.h>
#include <pgm_base.h>
#include <gr_basic.h>
#include <class_drawpanel.h>
#include <sch_draw_panel.h>
#include <confirm.h>
#include <sch_edit_frame.h>
@ -49,6 +49,10 @@
#include <sch_sheet_path.h>
#include <list_operations.h>
#include <preview_items/selection_area.h>
#include <sch_view.h>
#include <view/view_group.h>
static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool aErase );
@ -176,7 +180,9 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
}
m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, false );
m_canvas->Refresh();
GetCanvas()->GetView()->ClearPreview();
GetCanvas()->GetView()->ClearHiddenFlags();
}
@ -187,6 +193,14 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* aDC )
bool append = false;
BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
auto panel =static_cast<SCH_DRAW_PANEL*>(m_canvas);
auto view = panel->GetView();
auto area = view->GetSelectionArea();
view->ShowSelectionArea( false );
view->ClearHiddenFlags();
if( block->GetCount() )
{
BLOCK_STATE_T state = block->GetState();
@ -374,7 +388,6 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* aDC )
if( block->GetCommand() == BLOCK_ABORT )
{
GetScreen()->ClearDrawingState();
m_canvas->Refresh();
}
if( ! nextcmd )
@ -389,6 +402,11 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* aDC )
if( zoom_command )
Window_Zoom( GetScreen()->m_BlockLocate );
view->ShowPreview( false );
view->ShowSelectionArea( false );
view->ClearHiddenFlags();
return nextcmd;
}
@ -399,41 +417,30 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* aDC )
static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{
auto panel =static_cast<SCH_DRAW_PANEL*>(aPanel);
auto view = panel->GetView();
auto preview = view->GetPreview();
BASE_SCREEN* screen = aPanel->GetScreen();
BLOCK_SELECTOR* block = &screen->m_BlockLocate;
SCH_ITEM* schitem;
/* Erase old block contents. */
if( aErase )
{
block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
block->SetMoveVector( panel->GetParent()->GetCrossHairPosition() - block->GetLastCursorPosition() );
for( unsigned ii = 0; ii < block->GetCount(); ii++ )
{
schitem = (SCH_ITEM*) block->GetItem( ii );
if( schitem->Type() == SCH_COMPONENT_T )
((SCH_COMPONENT*)schitem)->Draw( aPanel, aDC, block->GetMoveVector(),
g_XorMode, g_GhostColor, false );
else
schitem->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, g_GhostColor );
}
}
/* Repaint new view. */
block->SetMoveVector( aPanel->GetParent()->GetCrossHairPosition() - block->GetLastCursorPosition() );
block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
preview->Clear();
view->SetVisible( preview, true );
for( unsigned ii = 0; ii < block->GetCount(); ii++ )
{
schitem = (SCH_ITEM*) block->GetItem( ii );
if( schitem->Type() == SCH_COMPONENT_T )
((SCH_COMPONENT*)schitem)->Draw( aPanel, aDC, block->GetMoveVector(),
g_XorMode, g_GhostColor, false );
else
schitem->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, g_GhostColor );
SCH_ITEM *copy = static_cast<SCH_ITEM*>( schitem->Clone() );
copy->Move( block->GetMoveVector() );
preview->Add( copy );
view->Hide( schitem );
}
view->Update( preview );
}
@ -545,8 +552,7 @@ void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC )
}
SetSchItemParent( item, GetScreen() );
item->Draw( m_canvas, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
GetScreen()->Append( item );
AddToScreen( item );
}
SaveCopyInUndoList( picklist, UR_NEW );
@ -568,3 +574,36 @@ void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC )
return;
}
void DrawAndSizingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{
auto panel =static_cast<SCH_DRAW_PANEL*>(aPanel);
auto area = panel->GetView()->GetSelectionArea();
auto frame = static_cast<EDA_BASE_FRAME*>(aPanel->GetParent());
BLOCK_SELECTOR* block;
bool isLibEdit = frame->IsType( FRAME_SCH_LIB_EDITOR );
block = &aPanel->GetScreen()->m_BlockLocate;
block->SetMoveVector( wxPoint( 0, 0 ) );
block->SetLastCursorPosition( aPanel->GetParent()->GetCrossHairPosition( isLibEdit ) );
block->SetEnd( aPanel->GetParent()->GetCrossHairPosition() );
panel->GetView()->ClearPreview();
panel->GetView()->ClearHiddenFlags();
area->SetOrigin( block->GetOrigin() );;
area->SetEnd( block->GetEnd() );
panel->GetView()->SetVisible( area );
panel->GetView()->Hide( area, false );
panel->GetView()->Update( area );
if( block->GetState() == STATE_BLOCK_INIT )
{
if( block->GetWidth() || block->GetHeight() )
// 2nd point exists: the rectangle is not surface anywhere
block->SetState( STATE_BLOCK_END );
}
}

View File

@ -29,7 +29,7 @@
#include <fctsys.h>
#include <gr_basic.h>
#include <class_drawpanel.h>
#include <sch_draw_panel.h>
#include <sch_edit_frame.h>
#include <lib_draw_item.h>
@ -42,6 +42,9 @@
#include <sch_text.h>
#include <sch_component.h>
#include <sch_sheet.h>
#include <sch_view.h>
#include <view/view_group.h>
static void AbortCreateNewLine( EDA_DRAW_PANEL* aPanel, wxDC* aDC );
@ -129,17 +132,6 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
segment = (SCH_LINE*) s_wires.begin();
COLOR4D color = GetLayerColor( segment->GetLayer() );
if( aErase )
{
while( segment )
{
if( !segment->IsNull() ) // Redraw if segment length != 0
segment->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, color );
segment = segment->Next();
}
}
SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) aPanel->GetParent();
wxPoint endpos = frame->GetCrossHairPosition();
@ -151,13 +143,18 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
segment = (SCH_LINE*) s_wires.begin();
auto view = static_cast<SCH_DRAW_PANEL*>( aPanel )->GetView();
view->ClearPreview();
while( segment )
{
if( !segment->IsNull() ) // Redraw if segment length != 0
segment->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, color );
view->AddToPreview( segment->Clone() );
segment = segment->Next();
}
}
@ -327,7 +324,13 @@ void SCH_EDIT_FRAME::EndSegment()
SetRepeatItem( segment = (SCH_LINE*) s_wires.GetLast() );
// Add the new wires
screen->Append( s_wires );
AddToScreen( s_wires );
auto view = GetCanvas()->GetView();
view->ClearPreview();
view->ShowPreview( false );
view->ClearHiddenFlags();
SaveCopyInUndoList(itemList, UR_NEW);
// Correct and remove segments that need to be merged.
@ -464,7 +467,7 @@ void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC )
DrawSegment( m_canvas, DC, wxDefaultPosition, false );
screen->Remove( screen->GetCurItem() );
RemoveFromScreen( screen->GetCurItem() );
m_canvas->SetMouseCaptureCallback( NULL );
screen->SetCurItem( NULL );
}
@ -534,7 +537,7 @@ bool SCH_EDIT_FRAME::TrimWire( const wxPoint& aStart, const wxPoint& aEnd, bool
line = return_line;
SaveCopyInUndoList( (SCH_ITEM*)line, UR_DELETED, aAppend );
GetScreen()->Remove( (SCH_ITEM*)line );
RemoveFromScreen( (SCH_ITEM*)line );
aAppend = true;
retval = true;
}
@ -619,7 +622,7 @@ bool SCH_EDIT_FRAME::SchematicCleanUp( bool aAppend )
remove_item( item );
remove_item( secondItem );
itemList.PushItem( ITEM_PICKER( line, UR_NEW ) );
screen->Append( (SCH_ITEM*) line );
AddToScreen( (SCH_ITEM*) line );
break;
}
}
@ -634,7 +637,7 @@ bool SCH_EDIT_FRAME::SchematicCleanUp( bool aAppend )
secondItem = item->Next();
if( item->GetFlags() & STRUCT_DELETED )
screen->Remove( item );
RemoveFromScreen( item );
}
SaveCopyInUndoList( itemList, UR_CHANGED, aAppend );
@ -656,7 +659,7 @@ bool SCH_EDIT_FRAME::BreakSegment( SCH_LINE* aSegment, const wxPoint& aPoint, bo
newSegment->SetStartPoint( aPoint );
aSegment->SetEndPoint( aPoint );
GetScreen()->Append( newSegment );
AddToScreen( newSegment );
if( aNewSegment )
*aNewSegment = newSegment;
@ -719,7 +722,7 @@ void SCH_EDIT_FRAME::DeleteJunction( SCH_ITEM* aJunction, bool aAppend )
{
aItem->SetFlags( STRUCT_DELETED );
itemList.PushItem( ITEM_PICKER( aItem, UR_DELETED ) );
screen->Remove( aItem );
RemoveFromScreen( aItem );
};
remove_item( aJunction );
@ -756,7 +759,7 @@ void SCH_EDIT_FRAME::DeleteJunction( SCH_ITEM* aJunction, bool aAppend )
remove_item( item );
remove_item( secondItem );
itemList.PushItem( ITEM_PICKER( line, UR_NEW ) );
screen->Append( (SCH_ITEM*) line );
AddToScreen( line );
break;
}
}
@ -770,7 +773,7 @@ void SCH_EDIT_FRAME::DeleteJunction( SCH_ITEM* aJunction, bool aAppend )
nextitem = item->Next();
if( item->GetFlags() & STRUCT_DELETED )
screen->Remove( item );
RemoveFromScreen( item );
}
}
@ -781,11 +784,17 @@ SCH_JUNCTION* SCH_EDIT_FRAME::AddJunction( const wxPoint& aPosition, bool aAppen
SCH_SCREEN* screen = GetScreen();
bool broken_segments = false;
screen->Append( junction );
AddToScreen( junction );
broken_segments = BreakSegments( aPosition, aAppend );
screen->TestDanglingEnds();
OnModify();
SaveCopyInUndoList( junction, UR_NEW, broken_segments || aAppend );
auto view = GetCanvas()->GetView();
view->ClearPreview();
view->ShowPreview( false );
view->ClearHiddenFlags();
return junction;
}
@ -795,11 +804,16 @@ SCH_NO_CONNECT* SCH_EDIT_FRAME::AddNoConnect( const wxPoint& aPosition )
SCH_NO_CONNECT* no_connect = new SCH_NO_CONNECT( aPosition );
SetRepeatItem( no_connect );
GetScreen()->Append( no_connect );
AddToScreen( no_connect );
SchematicCleanUp();
GetScreen()->TestDanglingEnds();
OnModify();
m_canvas->Refresh();
auto view = GetCanvas()->GetView();
view->ClearPreview();
view->ShowPreview( false );
view->ClearHiddenFlags();
SaveCopyInUndoList( no_connect, UR_NEW );
return no_connect;
}
@ -810,19 +824,23 @@ SCH_NO_CONNECT* SCH_EDIT_FRAME::AddNoConnect( const wxPoint& aPosition )
static void AbortCreateNewLine( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
{
SCH_SCREEN* screen = (SCH_SCREEN*) aPanel->GetScreen();
SCH_EDIT_FRAME* parent = ( SCH_EDIT_FRAME* ) aPanel->GetParent();
if( screen->GetCurItem() )
{
s_wires.DeleteAll(); // Free the list, for a future usage
screen->SetCurItem( NULL );
aPanel->Refresh();
}
else
{
SCH_EDIT_FRAME* parent = ( SCH_EDIT_FRAME* ) aPanel->GetParent();
parent->SetRepeatItem( NULL );
}
auto view = static_cast<SCH_DRAW_PANEL*>(aPanel)->GetView();
view->ClearPreview();
view->ShowPreview( false );
view->ClearHiddenFlags();
// Clear flags used in edit functions.
screen->ClearDrawingState();
}
@ -851,7 +869,6 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
my_clone->SetFlags( IS_NEW );
( (SCH_COMPONENT*) my_clone )->SetTimeStamp( GetNewTimeStamp() );
my_clone->Move( pos );
my_clone->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode );
PrepareMoveItem( my_clone, DC );
}
else
@ -861,16 +878,11 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
if( my_clone->CanIncrementLabel() )
( (SCH_TEXT*) my_clone )->IncrementLabel( GetRepeatDeltaLabel() );
GetScreen()->Append( my_clone );
AddToScreen( my_clone );
if( my_clone->IsConnectable() )
{
GetScreen()->TestDanglingEnds();
m_canvas->Refresh();
}
else
{
my_clone->Draw( m_canvas, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
}
SaveCopyInUndoList( my_clone, UR_NEW );

View File

@ -30,7 +30,7 @@
#include <fctsys.h>
#include <gr_basic.h>
#include <class_drawpanel.h>
#include <sch_draw_panel.h>
#include <sch_edit_frame.h>
#include <sch_bus_entry.h>
@ -74,10 +74,8 @@ void SCH_EDIT_FRAME::SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY_BASE* BusEntry, c
s_LastShape = entry_shape == '/' ? '/' : '\\';
BusEntry->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode );
BusEntry->SetBusEntryShape( s_LastShape );
GetScreen()->TestDanglingEnds();
BusEntry->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode );
OnModify( );
}

View File

@ -30,7 +30,7 @@
#include <fctsys.h>
#include <macros.h>
#include <kicad_string.h>
#include <class_drawpanel.h>
#include <sch_draw_panel.h>
#include <plotter.h>
#include <gr_basic.h>
#include <sch_screen.h>
@ -956,7 +956,6 @@ bool LIB_PART::HasConversion() const
return false;
}
void LIB_PART::ClearStatus()
{
for( LIB_ITEM& item : m_drawings )
@ -965,157 +964,6 @@ void LIB_PART::ClearStatus()
}
}
int LIB_PART::SelectItems( EDA_RECT& aRect, int aUnit, int aConvert, bool aSyncPinEdit )
{
int itemCount = 0;
for( LIB_ITEM& item : m_drawings )
{
item.ClearFlags( SELECTED );
if( ( item.m_Unit && item.m_Unit != aUnit )
|| ( item.m_Convert && item.m_Convert != aConvert ) )
{
if( item.Type() != LIB_PIN_T )
continue;
// Specific rules for pins:
// - do not select pins in other units when synchronized pin edit mode is disabled
// - do not select pins in other units when units are not interchangeable
// - in other cases verify if the pin belongs to the requested unit
if( !aSyncPinEdit || m_unitsLocked
|| ( item.m_Convert && item.m_Convert != aConvert ) )
continue;
}
if( item.Inside( aRect ) )
{
item.SetFlags( SELECTED );
itemCount++;
}
}
return itemCount;
}
void LIB_PART::MoveSelectedItems( const wxPoint& aOffset )
{
for( LIB_ITEM& item : m_drawings )
{
if( !item.IsSelected() )
continue;
item.SetOffset( aOffset );
item.m_Flags = 0;
}
}
void LIB_PART::ClearSelectedItems()
{
for( LIB_ITEM& item : m_drawings )
{
item.m_Flags = 0;
}
}
void LIB_PART::DeleteSelectedItems()
{
LIB_ITEMS_CONTAINER::ITERATOR item = m_drawings.begin();
// We *do not* remove the 2 mandatory fields: reference and value
// so skip them (do not remove) if they are flagged selected.
// Skip also not visible items.
// But I think fields must not be deleted by a block delete command or other global command
// because they are not really graphic items
while( item != m_drawings.end() )
{
if( item->Type() == LIB_FIELD_T )
{
item->ClearFlags( SELECTED );
}
if( !item->IsSelected() )
++item;
else
item = m_drawings.erase( item );
}
}
void LIB_PART::CopySelectedItems( const wxPoint& aOffset )
{
std::vector< LIB_ITEM* > tmp;
for( LIB_ITEM& item : m_drawings )
{
// We *do not* copy fields because they are unique for the whole component
// so skip them (do not duplicate) if they are flagged selected.
if( item.Type() == LIB_FIELD_T )
item.ClearFlags( SELECTED );
if( !item.IsSelected() )
continue;
item.ClearFlags( SELECTED );
LIB_ITEM* newItem = (LIB_ITEM*) item.Clone();
newItem->SetFlags( SELECTED );
// When push_back elements in buffer, a memory reallocation can happen
// and will break pointers.
// So, push_back later.
tmp.push_back( newItem );
}
for( auto item : tmp )
m_drawings.push_back( item );
MoveSelectedItems( aOffset );
}
void LIB_PART::MirrorSelectedItemsH( const wxPoint& aCenter )
{
for( LIB_ITEM& item : m_drawings )
{
if( !item.IsSelected() )
continue;
item.MirrorHorizontal( aCenter );
item.m_Flags = 0;
}
}
void LIB_PART::MirrorSelectedItemsV( const wxPoint& aCenter )
{
for( LIB_ITEM& item : m_drawings )
{
if( !item.IsSelected() )
continue;
item.MirrorVertical( aCenter );
item.m_Flags = 0;
}
}
void LIB_PART::RotateSelectedItems( const wxPoint& aCenter )
{
for( LIB_ITEM& item : m_drawings )
{
if( !item.IsSelected() )
continue;
item.Rotate( aCenter );
item.m_Flags = 0;
}
}
LIB_ITEM* LIB_PART::LocateDrawItem( int aUnit, int aConvert,
KICAD_T aType, const wxPoint& aPoint )
{

View File

@ -578,70 +578,6 @@ public:
*/
void ClearStatus();
/**
* Checks all draw objects of part to see if they are with block.
*
* Use this method to mark draw objects as selected during block
* functions.
*
* @param aRect - The bounding rectangle to test in draw items are inside.
* @param aUnit - The current unit number to test against.
* @param aConvert - Are the draw items being selected a conversion.
* @param aSyncPinEdit - Enable pin selection in other units.
* @return The number of draw objects found inside the block select
* rectangle.
*/
int SelectItems( EDA_RECT& aRect, int aUnit, int aConvert, bool aSyncPinEdit );
/**
* Clears all the draw items marked by a block select.
*/
void ClearSelectedItems();
/**
* Deletes the select draw items marked by a block select.
*
* The name and reference field will not be deleted. They are the
* minimum drawing items required for any part. Their properties
* can be changed but the cannot be removed.
*/
void DeleteSelectedItems();
/**
* Move the selected draw items marked by a block select.
*/
void MoveSelectedItems( const wxPoint& aOffset );
/**
* Make a copy of the selected draw items marked by a block select.
*
* Fields are not copied. Only part body items are copied.
* Copying fields would result in duplicate fields which does not
* make sense in this context.
*/
void CopySelectedItems( const wxPoint& aOffset );
/**
* Horizontally (X axis) mirror selected draw items about a point.
*
* @param aCenter - Center point to mirror around.
*/
void MirrorSelectedItemsH( const wxPoint& aCenter );
/**
* Vertically (Y axis) mirror selected draw items about a point.
*
* @param aCenter - Center point to mirror around.
*/
void MirrorSelectedItemsV( const wxPoint& aCenter );
/**
* Rotate CCW selected draw items about a point.
*
* @param aCenter - Center point to mirror around.
*/
void RotateSelectedItems( const wxPoint& aCenter );
/**
* Locate a draw object.
*

View File

@ -29,7 +29,7 @@
#include <fctsys.h>
#include <gr_basic.h>
#include <class_drawpanel.h>
#include <sch_draw_panel.h>
#include <eda_dde.h>
#include <sch_edit_frame.h>
#include <menus_helpers.h>
@ -235,6 +235,7 @@ bool SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KE
return false;
}
// when moving mouse, use the "magnetic" grid, unless the shift+ctrl keys is pressed
// for next cursor position
// ( shift or ctrl key down are PAN command with mouse wheel)
@ -275,48 +276,6 @@ bool SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KE
}
bool LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey )
{
// Filter out the 'fake' mouse motion after a keyboard movement
if( !aHotKey && m_movingCursorWithKeyboard )
{
m_movingCursorWithKeyboard = false;
return false;
}
// when moving mouse, use the "magnetic" grid, unless the shift+ctrl keys is pressed
// for next cursor position
// ( shift or ctrl key down are PAN command with mouse wheel)
bool snapToGrid = true;
if( !aHotKey && wxGetKeyState( WXK_SHIFT ) && wxGetKeyState( WXK_CONTROL ) )
snapToGrid = false;
// Cursor is left off grid only if no block in progress
if( GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
snapToGrid = true;
wxPoint pos = aPosition;
wxPoint oldpos = GetCrossHairPosition();
bool keyHandled = GeneralControlKeyMovement( aHotKey, &pos, snapToGrid );
// Update the cursor position.
SetCrossHairPosition( pos, snapToGrid );
RefreshCrossHair( oldpos, aPosition, aDC );
if( aHotKey && OnHotKey( aDC, aHotKey, aPosition, NULL ) )
{
keyHandled = true;
}
// Make sure current-part highlighting doesn't get lost in selection highlighting
ClearSearchTreeSelection();
UpdateStatusBar();
return keyHandled;
}
bool LIB_VIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey )
{

View File

@ -33,7 +33,7 @@
#include <kiway_express.h>
#include <macros.h>
#include <eda_dde.h>
#include <class_drawpanel.h>
#include <sch_draw_panel.h>
#include <sch_edit_frame.h>
#include <general.h>

View File

@ -27,7 +27,7 @@
#include <vector>
#include <fctsys.h>
#include <class_drawpanel.h>
#include <sch_draw_panel.h>
#include <sch_marker.h>
#include <wx/html/htmlwin.h>

View File

@ -30,7 +30,7 @@
#include <fctsys.h>
#include <sch_edit_frame.h>
#include <class_drawpanel.h>
#include <sch_draw_panel.h>
#include <bitmaps.h>
#include <confirm.h>

View File

@ -25,7 +25,7 @@
#include <wx/tooltip.h>
#include <pgm_base.h>
#include <kiface_i.h>
#include <class_drawpanel.h>
#include <sch_draw_panel.h>
#include <confirm.h>
#include <sch_edit_frame.h>
#include <grid_tricks.h>

View File

@ -30,7 +30,7 @@
#include <fctsys.h>
#include <sch_edit_frame.h>
#include <class_drawpanel.h>
#include <sch_draw_panel.h>
#include <sch_component.h>
#include <sch_reference_list.h>
#include <pgm_base.h>

View File

@ -34,7 +34,7 @@
#include <sch_edit_frame.h>
#include <base_units.h>
#include <class_drawpanel.h>
#include <sch_draw_panel.h>
#include <general.h>
#include <draw_graphic_text.h>
#include <confirm.h>

View File

@ -29,7 +29,7 @@
*/
#include <fctsys.h>
#include <class_drawpanel.h>
#include <sch_draw_panel.h>
#include <kicad_string.h>
#include <gestfich.h>
#include <pgm_base.h>

View File

@ -23,6 +23,7 @@
*/
#include <fctsys.h>
#include <sch_draw_panel.h>
#include <lib_edit_frame.h>
#include <class_libentry.h>
#include <lib_text.h>

View File

@ -25,7 +25,7 @@
#include <fctsys.h>
#include <pgm_base.h>
#include <gr_basic.h>
#include <class_drawpanel.h>
#include <sch_draw_panel.h>
#include <confirm.h>
#include <sch_screen.h>
#include <sch_edit_frame.h>
@ -386,7 +386,7 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
EDA_RECT oldClipBox;
wxRect fitRect;
wxDC* dc = GetDC();
EDA_DRAW_PANEL* panel = m_parent->GetCanvas();
auto panel = m_parent->GetCanvas();
wxBusyCursor dummy;

View File

@ -27,7 +27,7 @@
*/
#include <fctsys.h>
#include <class_drawpanel.h>
#include <sch_draw_panel.h>
#include <sch_edit_frame.h>
#include <sch_bitmap.h>

View File

@ -30,7 +30,7 @@
#include <fctsys.h>
#include <gr_basic.h>
#include <class_drawpanel.h>
#include <sch_draw_panel.h>
#include <confirm.h>
#include <sch_edit_frame.h>
#include <msgpanel.h>

View File

@ -31,7 +31,7 @@
#include <gr_basic.h>
#include <base_struct.h>
#include <draw_graphic_text.h>
#include <class_drawpanel.h>
#include <sch_draw_panel.h>
#include <confirm.h>
#include <sch_edit_frame.h>
#include <kicad_device_context.h>
@ -119,8 +119,7 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType )
}
// Prepare display to move the new item
textItem->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );
PrepareMoveItem( (SCH_ITEM*) textItem, aDC );
PrepareMoveItem( (SCH_ITEM*) textItem, nullptr );
return textItem;
}
@ -217,9 +216,7 @@ void SCH_EDIT_FRAME::OnConvertTextType( wxCommandEvent& aEvent )
* put in undo list later, at the end of the current command (if not aborted)
*/
INSTALL_UNBUFFERED_DC( dc, m_canvas );
m_canvas->CrossHairOff( &dc ); // Erase schematic cursor
text->Draw( m_canvas, &dc, wxPoint( 0, 0 ), g_XorMode );
m_canvas->CrossHairOff(); // Erase schematic cursor
// For an exiting item (i.e. already in list):
// replace the existing item by the new text in list
@ -227,16 +224,15 @@ void SCH_EDIT_FRAME::OnConvertTextType( wxCommandEvent& aEvent )
{
if( item == text )
{
screen->Remove( text );
screen->Append( newtext );
RemoveFromScreen( text );
AddToScreen( newtext );
break;
}
}
SetRepeatItem( NULL );
OnModify();
newtext->Draw( m_canvas, &dc, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
m_canvas->CrossHairOn( &dc ); // redraw schematic cursor
m_canvas->CrossHairOn( ); // redraw schematic cursor
// if the old item is the current schematic item, replace it by the new text:
if( screen->GetCurItem() == text )

View File

@ -29,7 +29,7 @@
#include <fctsys.h>
#include <gr_basic.h>
#include <class_drawpanel.h>
#include <sch_draw_panel.h>
#include <sch_edit_frame.h>
#include <general.h>
@ -56,31 +56,9 @@ void SCH_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
if( GetScreen() == NULL )
return;
m_canvas->DrawBackGround( DC );
GetScreen()->Draw( m_canvas, DC, GR_DEFAULT_DRAWMODE );
DrawWorkSheet( DC, GetScreen(), GetDefaultLineThickness(), IU_PER_MILS,
GetScreen()->GetFileName() );
#ifdef USE_WX_OVERLAY
if( IsShown() )
{
m_overlay.Reset();
wxDCOverlay overlaydc( m_overlay, (wxWindowDC*)DC );
overlaydc.Clear();
/* TODO: Investigate why toolbars are affected - to be searched in wxWidgets */
m_mainToolBar->Refresh();
m_drawToolBar->Refresh();
m_optionsToolBar->Refresh();
}
#endif
if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
m_canvas->DrawCrossHair( DC );
// Display the sheet filename, and the sheet path, for non root sheets
UpdateTitle();
}

View File

@ -28,7 +28,7 @@
#include <fctsys.h>
#include <pgm_base.h>
#include <kiface_i.h>
#include <class_drawpanel.h>
#include <sch_draw_panel.h>
#include <confirm.h>
#include <gestfich.h>
#include <sch_edit_frame.h>
@ -47,6 +47,8 @@
#include <dialogs/panel_eeschema_display_options.h>
#include <widgets/widget_eeschema_color_config.h>
#include <dialogs/panel_libedit_settings.h>
#include <sch_view.h>
#include <sch_painter.h>
#define FR_HISTORY_LIST_CNT 10 ///< Maximum number of find and replace strings.

View File

@ -29,7 +29,7 @@
*/
#include <fctsys.h>
#include <class_drawpanel.h>
#include <sch_draw_panel.h>
#include <kicad_string.h>
#include <sch_edit_frame.h>

View File

@ -28,7 +28,7 @@
#include <fctsys.h>
#include <gr_basic.h>
#include <class_drawpanel.h>
#include <sch_draw_panel.h>
#include <general.h>
#include <kicad_device_context.h>
#include <sch_edit_frame.h>
@ -43,7 +43,6 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event )
if( !curr_item || curr_item->GetFlags() )
return;
INSTALL_UNBUFFERED_DC( dc, m_canvas );
switch( curr_item->Type() )
{
@ -55,8 +54,7 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event )
newitem->ClearAnnotation( NULL );
newitem->SetFlags( IS_NEW );
// Draw the new part, MoveItem() expects it to be already on screen.
newitem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), g_XorMode );
PrepareMoveItem( newitem, &dc );
PrepareMoveItem( newitem, nullptr );
}
break;
@ -68,8 +66,7 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event )
SCH_TEXT* newitem = (SCH_TEXT*) curr_item->Clone();
newitem->SetFlags( IS_NEW );
// Draw the new item, MoveItem() expects it to be already on screen.
newitem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), g_XorMode );
PrepareMoveItem( newitem, &dc );
PrepareMoveItem( newitem, nullptr );
}
break;

Some files were not shown because too many files have changed in this diff Show More